@Test public void getIdForCharset() throws Exception { assertThat(encoding.getIdForCharset(StandardCharsets.ISO_8859_1), is(TextEncoding.ISO_8859_1)); assertThat(encoding.getIdForCharset(StandardCharsets.UTF_16), is(TextEncoding.UTF_16)); assertThat(encoding.getIdForCharset(StandardCharsets.UTF_16BE), is(TextEncoding.UTF_16BE)); assertThat(encoding.getIdForCharset(StandardCharsets.UTF_8), is(TextEncoding.UTF_8)); }
public byte getIdForCharset(final Charset charset) throws NoSuchElementException { for (byte i = 0; i <= MAX_TEXT_ENCODING_ID; i++) { if (values[i].equals(charset)) { return i; } } throw new NoSuchElementException(charset == null ? "null" : charset.name()); }
TextEncoding implements SimpleIntStringMap { public byte getIdForCharset(final Charset charset) throws NoSuchElementException { for (byte i = 0; i <= MAX_TEXT_ENCODING_ID; i++) { if (values[i].equals(charset)) { return i; } } throw new NoSuchElementException(charset == null ? "null" : charset.name()); } }
TextEncoding implements SimpleIntStringMap { public byte getIdForCharset(final Charset charset) throws NoSuchElementException { for (byte i = 0; i <= MAX_TEXT_ENCODING_ID; i++) { if (values[i].equals(charset)) { return i; } } throw new NoSuchElementException(charset == null ? "null" : charset.name()); } private  TextEncoding(); }
TextEncoding implements SimpleIntStringMap { public byte getIdForCharset(final Charset charset) throws NoSuchElementException { for (byte i = 0; i <= MAX_TEXT_ENCODING_ID; i++) { if (values[i].equals(charset)) { return i; } } throw new NoSuchElementException(charset == null ? "null" : charset.name()); } private  TextEncoding(); static TextEncoding getInstanceOf(); byte getIdForCharset(final Charset charset); Charset getCharsetForId(final int id); @Override boolean containsKey(final int key); @Override String getValue(final int key); }
TextEncoding implements SimpleIntStringMap { public byte getIdForCharset(final Charset charset) throws NoSuchElementException { for (byte i = 0; i <= MAX_TEXT_ENCODING_ID; i++) { if (values[i].equals(charset)) { return i; } } throw new NoSuchElementException(charset == null ? "null" : charset.name()); } private  TextEncoding(); static TextEncoding getInstanceOf(); byte getIdForCharset(final Charset charset); Charset getCharsetForId(final int id); @Override boolean containsKey(final int key); @Override String getValue(final int key); static final byte MAX_TEXT_ENCODING_ID; static final byte ISO_8859_1; static final byte UTF_16; static final byte UTF_16BE; static final byte UTF_8; static final int TEXT_ENCODING_FIELD_SIZE; }