Java Code Examples for org.apache.harmony.niochar.charset.additional.IBM437

Following code examples demonstrate how to use org.apache.harmony.niochar.charset.additional.IBM437from android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.apache.harmony.niochar.charset.additional.IBM437and various code implementation of this class.

  public void setCharset(String encoding) {
    Log.d("changing charset to " + encoding);
    Charset charset;
    if (encoding.equals("CP437")) {
      charset = new IBM437("IBM437", new String[] { "IBM437", "CP437" });
    } else {
      charset = Charset.forName(encoding);
    }

    if (charset == currentCharset || charset == null) {
      return;
    }

    CharsetDecoder newCd = charset.newDecoder();
    newCd.onUnmappableCharacter(CodingErrorAction.REPLACE);
    newCd.onMalformedInput(CodingErrorAction.REPLACE);

    currentCharset = charset;
    synchronized (this) {
      decoder = newCd;
    }
  } 


Advertisement
Javadoc
TODO: support direct byte buffers import org.apache.harmony.nio.AddressUtil; import org.apache.harmo

ny.niochar.CharsetProviderImpl;

Read More
Advertisement