Class HexCharset.Encoder
- Enclosing class:
- HexCharset
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencodeLoop(CharBuffer in, ByteBuffer out) Encodes one or more characters into one or more bytes.protected CoderResultimplFlush(ByteBuffer out) Flushes this encoder.protected voidClear stateMethods inherited from class java.nio.charset.CharsetEncoder
averageBytesPerChar, canEncode, canEncode, charset, encode, encode, flush, implOnMalformedInput, implOnUnmappableCharacter, implReplaceWith, isLegalReplacement, malformedInputAction, maxBytesPerChar, onMalformedInput, onUnmappableCharacter, replacement, replaceWith, reset, unmappableCharacterAction
-
Field Details
-
unpaired
private boolean unpaired -
nyble
private int nyble
-
-
Constructor Details
-
Encoder
private Encoder()
-
-
Method Details
-
implFlush
Flushes this encoder.The default implementation of this method does nothing, and always returns
CoderResult.UNDERFLOW. This method should be overridden by encoders that may need to write final bytes to the output buffer once the entire input sequence has been read.- Overrides:
implFlushin classCharsetEncoder- Parameters:
out- The output byte buffer- Returns:
- A coder-result object, either
CoderResult.UNDERFLOWorCoderResult.OVERFLOW
-
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
encodemethod, 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 mostout.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
CoderResultobject to describe its reason for termination, in the same manner as theencodemethod. Most implementations of this method will handle encoding errors by returning an appropriate result object for interpretation by theencodemethod. 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.UNDERFLOWuntil it receives sufficient input.- Specified by:
encodeLoopin classCharsetEncoder- Parameters:
in- The input character bufferout- The output byte buffer- Returns:
- A coder-result object describing the reason for termination
-
implReset
protected void implReset()Clear state- Overrides:
implResetin classCharsetEncoder
-