FixedByteValueDataCodingProvider.java

  1. package fr.sii.ogham.sms.sender.impl.cloudhopper.preparator;

  2. import com.cloudhopper.commons.gsm.DataCoding;

  3. import fr.sii.ogham.sms.encoder.Encoded;
  4. import fr.sii.ogham.sms.sender.impl.cloudhopper.exception.DataCodingException;

  5. /**
  6.  * Use a fixed value for every messages.
  7.  *
  8.  * @author AurĂ©lien Baudet
  9.  *
  10.  */
  11. public class FixedByteValueDataCodingProvider implements DataCodingProvider {
  12.     private final byte dcs;

  13.     /**
  14.      * Initializes with the Data Coding Scheme value to use for all messages.
  15.      *
  16.      * @param dcs
  17.      *            teh Data Coding Scheme value
  18.      */
  19.     public FixedByteValueDataCodingProvider(byte dcs) {
  20.         super();
  21.         this.dcs = dcs;
  22.     }

  23.     @Override
  24.     public DataCoding provide(Encoded encoded) throws DataCodingException {
  25.         return DataCoding.parse(dcs);
  26.     }

  27. }