Note that when the skip
methods mention detection of invalid
UTF-8 encodings, it only checks the first byte of a character. For multibyte
encodings, the second and third byte are not checked for correctness, just
skipped and ignored.
java.io.DataInput
Modifier and Type | Class and Description |
---|---|
private static class | UTF8Util.SkipCount
Helper class to hold skip counts; one for chars and one for bytes. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private static final UTF8Util. | Returns: A long array with counts; the characters skipped at positionCHAR_COUNT , the bytes skipped at position
BYTE_COUNT . Note that the number of characters skipped
may be smaller than the requested number.byte stream with UTF-8 encoded characters in, final long the number of characters to skip charsToSkip)Skip characters in the stream. |
public static final long | Returns: The number of bytes skipped.byte stream with UTF-8 encoded characters in, long number of characters to skip charsToSkip)Skip the requested number of characters from the stream. |
public static final long | Returns: The number of characters skipped.byte stream with UTF-8 encoded characters in)Skip until the end-of-stream is reached. |
UTF8Util | back to summary |
---|---|
private UTF8Util() This class cannot be instantiated. |
internalSkip | back to summary |
---|---|
private static final UTF8Util. Skip characters in the stream.
Note that a smaller number than requested might be skipped if the
end-of-stream is reached before the specified number of characters has
been decoded. It is up to the caller to decide if this is an error
or not. For instance, when determining the character length of a stream,
|
skipFully | back to summary |
---|---|
public static final long skipFully(InputStream in, long charsToSkip) throws EOFException, IOException Skip the requested number of characters from the stream.
|
skipUntilEOF | back to summary |
---|---|
public static final long skipUntilEOF(InputStream in) throws IOException Skip until the end-of-stream is reached.
|
Modifier and Type | Field and Description |
---|---|
private final long | byteCount
Number of bytes skipped. |
private final long | charCount
Number of characters skipped. |
Access | Constructor and Description |
---|---|
pack-priv | SkipCount(long
number of characters charCount, long number of bytes byteCount)Creates a holder for the specified skip counts. |
Modifier and Type | Method and Description |
---|---|
pack-priv long | |
pack-priv long |
byteCount | back to summary |
---|---|
private final long byteCount Number of bytes skipped. |
charCount | back to summary |
---|---|
private final long charCount Number of characters skipped. |
SkipCount | back to summary |
---|---|
pack-priv SkipCount(long charCount, long byteCount) Creates a holder for the specified skip counts.
|
bytesSkipped | back to summary |
---|---|
pack-priv long bytesSkipped() |
charsSkipped | back to summary |
---|---|
pack-priv long charsSkipped() |