APIdia Launch Partner
Top Inners Fields Constructors Methods
sun.nio.cs

public Class SingleByte

extends Object
Class Inheritance
Imports
jdk.internal.access.JavaLangAccess, .SharedSecrets, java.nio.Buffer, .ByteBuffer, .CharBuffer, java.nio.charset.Charset, .CharsetDecoder, .CharsetEncoder, .CoderResult

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
private static final JavaLangAccess

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
initC2B(char[] b2c, char[] c2bNR, char[] c2b, char[] c2bIndex)

private static final CoderResult
withResult(CoderResult cr, Buffer src, int sp, Buffer dst, int dp)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

JLAback to summary
private static final JavaLangAccess JLA

Constructor Detail

SingleByteback to summary
public SingleByte()

Method Detail

initC2Bback to summary
public static void initC2B(char[] b2c, char[] c2bNR, char[] c2b, char[] c2bIndex)
withResultback to summary
private static final CoderResult withResult(CoderResult cr, Buffer src, int sp, Buffer dst, int dp)
sun.nio.cs back to summary

public final Class SingleByte.Decoder

extends CharsetDecoder
implements ArrayDecoder
Class Inheritance
All Implemented Interfaces
sun.nio.cs.ArrayDecoder

Field Summary

Modifier and TypeField and Description
private final char[]
private final boolean
private final boolean
private char

Constructor Summary

AccessConstructor and Description
public
Decoder(Charset cs, char[] b2c)

public
Decoder(Charset cs, char[] b2c, boolean isASCIICompatible)

public
Decoder(Charset cs, char[] b2c, boolean isASCIICompatible, boolean isLatin1Decodable)

Method Summary

Modifier and TypeMethod and Description
public final char
decode(int b)

public int
decode(byte[] src, int sp, int len, char[] dst)

Implements sun.nio.cs.ArrayDecoder.decode.

private CoderResult
private CoderResult
protected CoderResult
decodeLoop(ByteBuffer src, CharBuffer dst)

Implements abstract java.nio.charset.CharsetDecoder.decodeLoop.

Decodes one or more bytes into one or more characters.

public int
decodeToLatin1(byte[] src, int sp, int len, byte[] dst)

Overrides default sun.nio.cs.ArrayDecoder.decodeToLatin1.

protected void
implReplaceWith(String newReplacement)

Overrides java.nio.charset.CharsetDecoder.implReplaceWith.

Reports a change to this decoder's replacement value.

public boolean
public boolean
Inherited from java.nio.charset.CharsetDecoder:
averageCharsPerBytecharsetdecodedecodedetectedCharsetflushimplFlushimplOnMalformedInputimplOnUnmappableCharacterimplResetisAutoDetectingisCharsetDetectedmalformedInputActionmaxCharsPerByteonMalformedInputonUnmappableCharacterreplacementreplaceWithresetunmappableCharacterAction

Field Detail

b2cback to summary
private final char[] b2c
isASCIICompatibleback to summary
private final boolean isASCIICompatible
isLatin1Decodableback to summary
private final boolean isLatin1Decodable
replback to summary
private char repl

Constructor Detail

Decoderback to summary
public Decoder(Charset cs, char[] b2c)
Decoderback to summary
public Decoder(Charset cs, char[] b2c, boolean isASCIICompatible)
Decoderback to summary
public Decoder(Charset cs, char[] b2c, boolean isASCIICompatible, boolean isLatin1Decodable)

Method Detail

decodeback to summary
public final char decode(int b)
decodeback to summary
public int decode(byte[] src, int sp, int len, char[] dst)

Implements sun.nio.cs.ArrayDecoder.decode.

Annotations
@Override
decodeArrayLoopback to summary
private CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst)
decodeBufferLoopback to summary
private CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst)
decodeLoopback to summary
protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst)

Implements abstract java.nio.charset.CharsetDecoder.decodeLoop.

Doc from java.nio.charset.CharsetDecoder.decodeLoop.

Decodes one or more bytes into one or more characters.

This method encapsulates the basic decoding loop, decoding as many bytes as possible until it either runs out of input, runs out of room in the output buffer, or encounters a decoding error. This method is invoked by the decode 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() bytes will be read, and at most out.remaining() characters will be written. The buffers' positions will be advanced to reflect the bytes read and the characters 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 decode method. Most implementations of this method will handle decoding errors by returning an appropriate result object for interpretation by the decode 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.

decodeToLatin1back to summary
public int decodeToLatin1(byte[] src, int sp, int len, byte[] dst)

Overrides default sun.nio.cs.ArrayDecoder.decodeToLatin1.

Annotations
@Override
implReplaceWithback to summary
protected void implReplaceWith(String newReplacement)

Overrides java.nio.charset.CharsetDecoder.implReplaceWith.

Doc from java.nio.charset.CharsetDecoder.implReplaceWith.

Reports a change to this decoder's replacement value.

The default implementation of this method does nothing. This method should be overridden by decoders that require notification of changes to the replacement.

isASCIICompatibleback to summary
public boolean isASCIICompatible()

Overrides default sun.nio.cs.ArrayDecoder.isASCIICompatible.

Annotations
@Override
isLatin1Decodableback to summary
public boolean isLatin1Decodable()

Overrides default sun.nio.cs.ArrayDecoder.isLatin1Decodable.

Annotations
@Override
sun.nio.cs back to summary

public final Class SingleByte.Encoder

extends CharsetEncoder
implements ArrayEncoder
Class Inheritance
All Implemented Interfaces
sun.nio.cs.ArrayEncoder

Field Summary

Modifier and TypeField and Description
private final char[]
private final char[]
private final boolean
private byte
private Surrogate.Parser

Constructor Summary

AccessConstructor and Description
public
Encoder(Charset cs, char[] c2b, char[] c2bIndex, boolean isASCIICompatible)

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.

public boolean
canEncode(CharSequence cs)

Overrides java.nio.charset.CharsetEncoder.canEncode.

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

public final int
encode(char ch)

private CoderResult
private CoderResult
public int
encodeFromLatin1(byte[] src, int sp, int len, byte[] dst, int dp)

Implements sun.nio.cs.ArrayEncoder.encodeFromLatin1.

public int
encodeFromUTF16(byte[] src, int sp, int len, byte[] dst, int dp)

Implements sun.nio.cs.ArrayEncoder.encodeFromUTF16.

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 void
implReplaceWith(byte[] newReplacement)

Overrides java.nio.charset.CharsetEncoder.implReplaceWith.

Reports a change to this encoder's replacement value.

public boolean
public boolean
isLegalReplacement(byte[] repl)

Overrides java.nio.charset.CharsetEncoder.isLegalReplacement.

Tells whether or not the given byte array is a legal replacement value for this encoder.

Inherited from java.nio.charset.CharsetEncoder:
averageBytesPerCharcharsetencodeencodeflushimplFlushimplOnMalformedInputimplOnUnmappableCharacterimplResetmalformedInputActionmaxBytesPerCharonMalformedInputonUnmappableCharacterreplacementreplaceWithresetunmappableCharacterAction

Field Detail

c2bback to summary
private final char[] c2b
c2bIndexback to summary
private final char[] c2bIndex
isASCIICompatibleback to summary
private final boolean isASCIICompatible
replback to summary
private byte repl
sgpback to summary
private Surrogate.Parser sgp

Constructor Detail

Encoderback to summary
public Encoder(Charset cs, char[] c2b, char[] c2bIndex, boolean isASCIICompatible)

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.

canEncodeback to summary
public boolean canEncode(CharSequence cs)

Overrides java.nio.charset.CharsetEncoder.canEncode.

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

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

If this method returns false for a particular character sequence then more information about why the sequence cannot be encoded may be obtained by performing a full encoding operation.

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.

encodeback to summary
public final int encode(char ch)
encodeArrayLoopback to summary
private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst)
encodeBufferLoopback to summary
private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst)
encodeFromLatin1back to summary
public int encodeFromLatin1(byte[] src, int sp, int len, byte[] dst, int dp)

Implements sun.nio.cs.ArrayEncoder.encodeFromLatin1.

Annotations
@Override
encodeFromUTF16back to summary
public int encodeFromUTF16(byte[] src, int sp, int len, byte[] dst, int dp)

Implements sun.nio.cs.ArrayEncoder.encodeFromUTF16.

Annotations
@Override
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.

implReplaceWithback to summary
protected void implReplaceWith(byte[] newReplacement)

Overrides java.nio.charset.CharsetEncoder.implReplaceWith.

Doc from java.nio.charset.CharsetEncoder.implReplaceWith.

Reports a change to this encoder's replacement value.

The default implementation of this method does nothing. This method should be overridden by encoders that require notification of changes to the replacement.

isASCIICompatibleback to summary
public boolean isASCIICompatible()

Implements sun.nio.cs.ArrayEncoder.isASCIICompatible.

Annotations
@Override
isLegalReplacementback to summary
public boolean isLegalReplacement(byte[] repl)

Overrides java.nio.charset.CharsetEncoder.isLegalReplacement.

Doc from java.nio.charset.CharsetEncoder.isLegalReplacement.

Tells whether or not the given byte array is a legal replacement value for this encoder.

A replacement is legal if, and only if, it is a legal sequence of bytes in this encoder's charset; that is, it must be possible to decode the replacement into one or more sixteen-bit Unicode characters.

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