March 2005
Beginner to intermediate
1254 pages
104h 21m
English
CharsetEncoder
A
CharsetEncoder is an
“encoding engine” that converts a
sequence of characters into a sequence of bytes using some character
encoding. Obtain a CharsetEncoder with the
newEncoder( ) method of the
Charset that represents the desired encoding.
A CharsetEncoder works like a
CharsetDecoder in reverse. Use the
encode( )
method to encode characters read from a CharBuffer
into bytes stored in a ByteBuffer. Please see
CharsetDecoder, which is documented in detail.
public abstract class CharsetEncoder { // Protected Constructors protected CharsetEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar); protected CharsetEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar, byte[ ] replacement); // Public Instance Methods public final float averageBytesPerChar( ); public boolean canEncode(CharSequence cs); public boolean canEncode(char c); public final Charset charset( ); public final java.nio.ByteBuffer encode(java.nio.CharBuffer in) throws CharacterCodingException; public final CoderResult encode(java.nio.CharBuffer in, java.nio.ByteBuffer out, boolean endOfInput); public final CoderResult flush(java.nio.ByteBuffer out); public boolean isLegalReplacement(byte[ ] repl); public CodingErrorAction malformedInputAction( ); public final float maxBytesPerChar( ); public final CharsetEncoder onMalformedInput(CodingErrorAction newAction); public final CharsetEncoder onUnmappableCharacter(CodingErrorAction newAction); public final byte[ ]
Read now
Unlock full access