APIdia Launch Partner
Top Fields Constructors Methods
sun.font

public abstract Class DoubleByteEncoder

extends CharsetEncoder
Class Inheritance
Known Direct Subclasses
sun.font.X11GB18030_0.Encoder, sun.font.X11GB18030_1.Encoder, sun.font.X11Johab.Encoder, sun.font.X11SunUnicode_0.Encoder
Imports
java.nio.ByteBuffer, .CharBuffer, java.nio.charset.Charset, .CharsetEncoder, .CoderResult, sun.nio.cs.Surrogate

Field Summary

Modifier and TypeField and Description
private final short[]
private final String[]
private final Surrogate.Parser

Constructor Summary

AccessConstructor and Description
protected
DoubleByteEncoder(Charset cs, short[] index1, String[] index2)

protected
DoubleByteEncoder(Charset cs, short[] index1, String[] index2, float avg, float max)

protected
DoubleByteEncoder(Charset cs, short[] index1, String[] index2, byte[] repl)

protected
DoubleByteEncoder(Charset cs, short[] index1, String[] index2, byte[] repl, float avg, float max)

Method Summary

Modifier and TypeMethod and Description
public boolean
canEncode(char c)

Overrides java.nio.charset.CharsetEncoder.canEncode.

Tells whether or not this encoder can encode the given character.

private CoderResult
private CoderResult
protected int
encodeDouble(char ch)

protected CoderResult
encodeLoop(CharBuffer src, ByteBuffer dst)

Implements abstract java.nio.charset.CharsetEncoder.encodeLoop.

Encodes one or more characters into one or more bytes.

protected int
encodeSingle(char inputChar)

protected byte[]
encodeSurrogate(char highSurrogate, char lowSurrogate)

Protected method which should be overridden by concrete DBCS CharsetEncoder classes which included supplementary characters within their mapping coverage.

Inherited from java.nio.charset.CharsetEncoder:
averageBytesPerCharcanEncodecharsetencodeencodeflushimplFlushimplOnMalformedInputimplOnUnmappableCharacterimplReplaceWithimplResetisLegalReplacementmalformedInputActionmaxBytesPerCharonMalformedInputonUnmappableCharacterreplacementreplaceWithresetunmappableCharacterAction

Field Detail

index1back to summary
private final short[] index1
index2back to summary
private final String[] index2
sgpback to summary
private final Surrogate.Parser sgp

Constructor Detail

DoubleByteEncoderback to summary
protected DoubleByteEncoder(Charset cs, short[] index1, String[] index2)
DoubleByteEncoderback to summary
protected DoubleByteEncoder(Charset cs, short[] index1, String[] index2, float avg, float max)
DoubleByteEncoderback to summary
protected DoubleByteEncoder(Charset cs, short[] index1, String[] index2, byte[] repl)
DoubleByteEncoderback to summary
protected DoubleByteEncoder(Charset cs, short[] index1, String[] index2, byte[] repl, float avg, float max)

Method Detail

canEncodeback to summary
public boolean canEncode(char c)

Overrides java.nio.charset.CharsetEncoder.canEncode.

Doc from java.nio.charset.CharsetEncoder.canEncode.

Tells whether or not this encoder can encode the given character.

This method returns false if the given character is a surrogate character; such characters can be interpreted only when they are members of a pair consisting of a high surrogate followed by a low surrogate. The canEncode(CharSequence) method may be used to test whether or not a character sequence can be encoded.

This method may modify this encoder's state; it should therefore not be invoked if an encoding operation is already in progress.

The default implementation of this method is not very efficient; it should generally be overridden to improve performance.

Annotations
@Override
encodeArrayLoopback to summary
private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst)
encodeBufferLoopback to summary
private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst)
encodeDoubleback to summary
protected int encodeDouble(char ch)
encodeLoopback to summary
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst)

Implements abstract java.nio.charset.CharsetEncoder.encodeLoop.

Doc from java.nio.charset.CharsetEncoder.encodeLoop.

Encodes one or more characters into one or more bytes.

This method encapsulates the basic encoding loop, encoding as many characters as possible until it either runs out of input, runs out of room in the output buffer, or encounters an encoding error. This method is invoked by the encode method, which handles result interpretation and error recovery.

The buffers are read from, and written to, starting at their current positions. At most in.remaining() characters will be read, and at most out.remaining() bytes will be written. The buffers' positions will be advanced to reflect the characters read and the bytes written, but their marks and limits will not be modified.

This method returns a CoderResult object to describe its reason for termination, in the same manner as the encode method. Most implementations of this method will handle encoding errors by returning an appropriate result object for interpretation by the encode method. An optimized implementation may instead examine the relevant error action and implement that action itself.

An implementation of this method may perform arbitrary lookahead by returning CoderResult#UNDERFLOW until it receives sufficient input.

Annotations
@Override
encodeSingleback to summary
protected int encodeSingle(char inputChar)
encodeSurrogateback to summary
protected byte[] encodeSurrogate(char highSurrogate, char lowSurrogate)

Protected method which should be overridden by concrete DBCS CharsetEncoder classes which included supplementary characters within their mapping coverage. null return value indicates surrogate values could not be handled or encoded.