@Test public void parse() { DataCoding dc = DataCoding.parse(DataCoding.CHAR_ENC_DEFAULT); Assert.assertEquals((byte)0x00, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_DEFAULT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.CHARACTER_ENCODING, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_0, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse(DataCoding.CHAR_ENC_8BIT); Assert.assertEquals((byte)0x04, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_8BIT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.CHARACTER_ENCODING, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_0, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse(DataCoding.CHAR_ENC_IA5); Assert.assertEquals((byte)0x01, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_IA5, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.CHARACTER_ENCODING, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_0, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse(DataCoding.CHAR_ENC_UCS2); Assert.assertEquals((byte)0x08, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_UCS2, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.CHARACTER_ENCODING, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_0, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse((byte)-15); Assert.assertEquals((byte)0xF1, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_DEFAULT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.MESSAGE_CLASS, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_1, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse((byte)16); Assert.assertEquals((byte)16, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_DEFAULT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.GENERAL, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_0, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse((byte)17); Assert.assertEquals((byte)17, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_DEFAULT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.GENERAL, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_1, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse((byte)20); Assert.assertEquals((byte)20, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_8BIT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.GENERAL, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_0, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse((byte)21); Assert.assertEquals((byte)21, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_8BIT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.GENERAL, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_1, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse((byte)21); Assert.assertEquals((byte)21, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_8BIT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.GENERAL, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_1, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse((byte)0x1C); Assert.assertEquals(DataCoding.CHAR_ENC_DEFAULT, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.RESERVED, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_0, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); dc = DataCoding.parse((byte)0x3B); Assert.assertEquals((byte)0x3B, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_UCS2, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.GENERAL, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_3, dc.getMessageClass()); Assert.assertEquals(true, dc.isCompressed()); dc = DataCoding.parse((byte)0xEA); Assert.assertEquals((byte)0xEA, dc.getByteValue()); Assert.assertEquals(DataCoding.CHAR_ENC_UCS2, dc.getCharacterEncoding()); Assert.assertEquals(DataCoding.Group.MESSAGE_WAITING_INDICATION, dc.getCodingGroup()); Assert.assertEquals(DataCoding.MESSAGE_CLASS_0, dc.getMessageClass()); Assert.assertEquals(false, dc.isCompressed()); }
static public DataCoding parse(byte dcs) { try { if ((dcs & (byte)0xF0) == 0x00) { return createCharacterEncodingGroup(dcs); } else if ((dcs & (byte)0xF0) == (byte)0xF0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((dcs & (byte)0x04) == (byte)0x04) { characterEncoding = CHAR_ENC_8BIT; } byte messageClass = (byte)(dcs & (byte)0x03); return createMessageClassGroup(characterEncoding, messageClass); } else if ((dcs & (byte)0xC0) == (byte)0x00) { boolean compressed = false; if ((dcs & (byte)0x20) == (byte)0x20) { compressed = true; } byte tempMessageClass = (byte)(dcs & (byte)0x03); Byte messageClass = null; if ((dcs & (byte)0x10) == (byte)0x10) { messageClass = new Byte(tempMessageClass); } byte characterEncoding = (byte)(dcs & (byte)0x0C); return createGeneralGroup(characterEncoding, messageClass, compressed); } else if ((dcs & (byte)0xC0) == (byte)0xC0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((byte)(dcs & (byte)0x20) == 0x20) { characterEncoding = CHAR_ENC_UCS2; } boolean store = false; if ((byte)(dcs & (byte)0x10) == 0x10) { store = true; } boolean indicatorActive = false; if ((byte)(dcs & (byte)0x08) == 0x08) { indicatorActive = true; } byte indicatorType = (byte)(dcs & (byte)0x03); return createMessageWaitingIndicationGroup(characterEncoding, store, indicatorActive, indicatorType); } else { return createReservedGroup(dcs); } } catch (IllegalArgumentException e) { return createReservedGroup(dcs); } }
DataCoding { static public DataCoding parse(byte dcs) { try { if ((dcs & (byte)0xF0) == 0x00) { return createCharacterEncodingGroup(dcs); } else if ((dcs & (byte)0xF0) == (byte)0xF0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((dcs & (byte)0x04) == (byte)0x04) { characterEncoding = CHAR_ENC_8BIT; } byte messageClass = (byte)(dcs & (byte)0x03); return createMessageClassGroup(characterEncoding, messageClass); } else if ((dcs & (byte)0xC0) == (byte)0x00) { boolean compressed = false; if ((dcs & (byte)0x20) == (byte)0x20) { compressed = true; } byte tempMessageClass = (byte)(dcs & (byte)0x03); Byte messageClass = null; if ((dcs & (byte)0x10) == (byte)0x10) { messageClass = new Byte(tempMessageClass); } byte characterEncoding = (byte)(dcs & (byte)0x0C); return createGeneralGroup(characterEncoding, messageClass, compressed); } else if ((dcs & (byte)0xC0) == (byte)0xC0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((byte)(dcs & (byte)0x20) == 0x20) { characterEncoding = CHAR_ENC_UCS2; } boolean store = false; if ((byte)(dcs & (byte)0x10) == 0x10) { store = true; } boolean indicatorActive = false; if ((byte)(dcs & (byte)0x08) == 0x08) { indicatorActive = true; } byte indicatorType = (byte)(dcs & (byte)0x03); return createMessageWaitingIndicationGroup(characterEncoding, store, indicatorActive, indicatorType); } else { return createReservedGroup(dcs); } } catch (IllegalArgumentException e) { return createReservedGroup(dcs); } } }
DataCoding { static public DataCoding parse(byte dcs) { try { if ((dcs & (byte)0xF0) == 0x00) { return createCharacterEncodingGroup(dcs); } else if ((dcs & (byte)0xF0) == (byte)0xF0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((dcs & (byte)0x04) == (byte)0x04) { characterEncoding = CHAR_ENC_8BIT; } byte messageClass = (byte)(dcs & (byte)0x03); return createMessageClassGroup(characterEncoding, messageClass); } else if ((dcs & (byte)0xC0) == (byte)0x00) { boolean compressed = false; if ((dcs & (byte)0x20) == (byte)0x20) { compressed = true; } byte tempMessageClass = (byte)(dcs & (byte)0x03); Byte messageClass = null; if ((dcs & (byte)0x10) == (byte)0x10) { messageClass = new Byte(tempMessageClass); } byte characterEncoding = (byte)(dcs & (byte)0x0C); return createGeneralGroup(characterEncoding, messageClass, compressed); } else if ((dcs & (byte)0xC0) == (byte)0xC0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((byte)(dcs & (byte)0x20) == 0x20) { characterEncoding = CHAR_ENC_UCS2; } boolean store = false; if ((byte)(dcs & (byte)0x10) == 0x10) { store = true; } boolean indicatorActive = false; if ((byte)(dcs & (byte)0x08) == 0x08) { indicatorActive = true; } byte indicatorType = (byte)(dcs & (byte)0x03); return createMessageWaitingIndicationGroup(characterEncoding, store, indicatorActive, indicatorType); } else { return createReservedGroup(dcs); } } catch (IllegalArgumentException e) { return createReservedGroup(dcs); } } protected  DataCoding(byte dcs, Group codingGroup, byte characterEncoding, byte messageClass, boolean compressed); }
DataCoding { static public DataCoding parse(byte dcs) { try { if ((dcs & (byte)0xF0) == 0x00) { return createCharacterEncodingGroup(dcs); } else if ((dcs & (byte)0xF0) == (byte)0xF0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((dcs & (byte)0x04) == (byte)0x04) { characterEncoding = CHAR_ENC_8BIT; } byte messageClass = (byte)(dcs & (byte)0x03); return createMessageClassGroup(characterEncoding, messageClass); } else if ((dcs & (byte)0xC0) == (byte)0x00) { boolean compressed = false; if ((dcs & (byte)0x20) == (byte)0x20) { compressed = true; } byte tempMessageClass = (byte)(dcs & (byte)0x03); Byte messageClass = null; if ((dcs & (byte)0x10) == (byte)0x10) { messageClass = new Byte(tempMessageClass); } byte characterEncoding = (byte)(dcs & (byte)0x0C); return createGeneralGroup(characterEncoding, messageClass, compressed); } else if ((dcs & (byte)0xC0) == (byte)0xC0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((byte)(dcs & (byte)0x20) == 0x20) { characterEncoding = CHAR_ENC_UCS2; } boolean store = false; if ((byte)(dcs & (byte)0x10) == 0x10) { store = true; } boolean indicatorActive = false; if ((byte)(dcs & (byte)0x08) == 0x08) { indicatorActive = true; } byte indicatorType = (byte)(dcs & (byte)0x03); return createMessageWaitingIndicationGroup(characterEncoding, store, indicatorActive, indicatorType); } else { return createReservedGroup(dcs); } } catch (IllegalArgumentException e) { return createReservedGroup(dcs); } } protected  DataCoding(byte dcs, Group codingGroup, byte characterEncoding, byte messageClass, boolean compressed); byte getByteValue(); Group getCodingGroup(); byte getCharacterEncoding(); byte getMessageClass(); boolean isCompressed(); static DataCoding createCharacterEncodingGroup(byte characterEncoding); static DataCoding createMessageClassGroup(byte characterEncoding, byte messageClass); static DataCoding createGeneralGroup(byte characterEncoding, Byte messageClass, boolean compressed); static DataCoding createMessageWaitingIndicationGroup(byte characterEncoding, boolean store, boolean active, byte indicatorType); static DataCoding createReservedGroup(byte dcs); static DataCoding parse(byte dcs); }
DataCoding { static public DataCoding parse(byte dcs) { try { if ((dcs & (byte)0xF0) == 0x00) { return createCharacterEncodingGroup(dcs); } else if ((dcs & (byte)0xF0) == (byte)0xF0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((dcs & (byte)0x04) == (byte)0x04) { characterEncoding = CHAR_ENC_8BIT; } byte messageClass = (byte)(dcs & (byte)0x03); return createMessageClassGroup(characterEncoding, messageClass); } else if ((dcs & (byte)0xC0) == (byte)0x00) { boolean compressed = false; if ((dcs & (byte)0x20) == (byte)0x20) { compressed = true; } byte tempMessageClass = (byte)(dcs & (byte)0x03); Byte messageClass = null; if ((dcs & (byte)0x10) == (byte)0x10) { messageClass = new Byte(tempMessageClass); } byte characterEncoding = (byte)(dcs & (byte)0x0C); return createGeneralGroup(characterEncoding, messageClass, compressed); } else if ((dcs & (byte)0xC0) == (byte)0xC0) { byte characterEncoding = CHAR_ENC_DEFAULT; if ((byte)(dcs & (byte)0x20) == 0x20) { characterEncoding = CHAR_ENC_UCS2; } boolean store = false; if ((byte)(dcs & (byte)0x10) == 0x10) { store = true; } boolean indicatorActive = false; if ((byte)(dcs & (byte)0x08) == 0x08) { indicatorActive = true; } byte indicatorType = (byte)(dcs & (byte)0x03); return createMessageWaitingIndicationGroup(characterEncoding, store, indicatorActive, indicatorType); } else { return createReservedGroup(dcs); } } catch (IllegalArgumentException e) { return createReservedGroup(dcs); } } protected  DataCoding(byte dcs, Group codingGroup, byte characterEncoding, byte messageClass, boolean compressed); byte getByteValue(); Group getCodingGroup(); byte getCharacterEncoding(); byte getMessageClass(); boolean isCompressed(); static DataCoding createCharacterEncodingGroup(byte characterEncoding); static DataCoding createMessageClassGroup(byte characterEncoding, byte messageClass); static DataCoding createGeneralGroup(byte characterEncoding, Byte messageClass, boolean compressed); static DataCoding createMessageWaitingIndicationGroup(byte characterEncoding, boolean store, boolean active, byte indicatorType); static DataCoding createReservedGroup(byte dcs); static DataCoding parse(byte dcs); static final byte MESSAGE_CLASS_0; static final byte MESSAGE_CLASS_1; static final byte MESSAGE_CLASS_2; static final byte MESSAGE_CLASS_3; static final byte CHAR_ENC_DEFAULT; static final byte CHAR_ENC_IA5; static final byte CHAR_ENC_8BITA; static final byte CHAR_ENC_LATIN1; static final byte CHAR_ENC_8BIT; static final byte CHAR_ENC_JIS; static final byte CHAR_ENC_CYRLLIC; static final byte CHAR_ENC_HEBREW; static final byte CHAR_ENC_UCS2; static final byte CHAR_ENC_PICTO; static final byte CHAR_ENC_MUSIC; static final byte CHAR_ENC_RSRVD; static final byte CHAR_ENC_RSRVD2; static final byte CHAR_ENC_EXKANJI; static final byte CHAR_ENC_KSC5601; static final byte CHAR_ENC_RSRVD3; }