List of usage examples for java.io UnsupportedEncodingException UnsupportedEncodingException
public UnsupportedEncodingException()
From source file:com.android.messaging.mmslib.pdu.CharacterSets.java
/** * Map a well-known charset name to its assigned MIBEnum number. * * @param mimeName The charset name.// w w w . j a v a 2 s . co m * @return The MIBEnum number assigned by IANA for this charset. */ public static int getMibEnumValue(final String mimeName) throws UnsupportedEncodingException { if (null == mimeName) { return -1; } final Integer mibEnumValue = NAME_TO_MIBENUM_MAP.get(mimeName); if (mibEnumValue == null) { throw new UnsupportedEncodingException(); } return mibEnumValue; }
From source file:org.alfresco.repo.search.impl.lucene.index.IndexInfo.java
private void writeString(ByteBuffer buffer, CRC32 crc32, String string) throws UnsupportedEncodingException { char[] chars = string.toCharArray(); byte[] bytes = new byte[chars.length]; for (int i = 0; i < chars.length; i++) { if (chars[i] > 0xFF) { throw new UnsupportedEncodingException(); }/*from w w w . j av a2s . c o m*/ bytes[i] = (byte) chars[i]; } buffer.putInt(bytes.length); buffer.put(bytes); crc32.update(bytes); }