DataCodingSpecification { public static String getCharsetName(byte dataCoding) { switch (dataCoding) { case 1: return US_ASCII; case 3: return ISO_8859_1; case 6: return ISO_8859_5; case 7: return ISO_8859_8; case 8: return UTF_16; case 14: return EUC_KR; case 5: case 10: case 13: return EUC_JP; case 2: case 4: case 0: default: return UTF_8; } }  static int getMaxCharacters(byte dataCoding); static String getCharsetName(byte dataCoding); static byte[] getMessageInBytes(String message, byte dataCoding); static final String US_ASCII; static final String ISO_8859_1; static final String ISO_8859_5; static final String ISO_8859_8; static final String UTF_16; static final String UTF_8; static final String EUC_KR; static final String EUC_JP; }
@Test public void testGetCharsetName() throws Exception { assertEqualsAndSupported("UTF-8", DataCodingSpecification.getCharsetName((byte)0)); assertEqualsAndSupported("US-ASCII", DataCodingSpecification.getCharsetName((byte)1)); assertEqualsAndSupported("UTF-8", DataCodingSpecification.getCharsetName((byte)2)); assertEqualsAndSupported("ISO-8859-1", DataCodingSpecification.getCharsetName((byte)3)); assertEqualsAndSupported("UTF-8", DataCodingSpecification.getCharsetName((byte)4)); assertEqualsAndSupported("EUC-JP", DataCodingSpecification.getCharsetName((byte)5)); assertEqualsAndSupported("ISO-8859-5", DataCodingSpecification.getCharsetName((byte)6)); assertEqualsAndSupported("ISO-8859-8", DataCodingSpecification.getCharsetName((byte)7)); assertEqualsAndSupported("UTF-16", DataCodingSpecification.getCharsetName((byte)8)); assertEqualsAndSupported("EUC-JP", DataCodingSpecification.getCharsetName((byte)10)); assertEqualsAndSupported("EUC-JP", DataCodingSpecification.getCharsetName((byte)13)); assertEqualsAndSupported("EUC-KR", DataCodingSpecification.getCharsetName((byte)14)); }