|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.iapi.util.UTF8Util
public final class UTF8Util
Utility methods for handling UTF-8 encoded byte streams.
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.
DataInput
Nested Class Summary | |
---|---|
private static class |
UTF8Util.SkipCount
Helper class to hold skip counts; one for chars and one for bytes. |
Constructor Summary | |
---|---|
private |
UTF8Util()
This class cannot be instantiated. |
Method Summary | |
---|---|
private static UTF8Util.SkipCount |
internalSkip(java.io.InputStream in,
long charsToSkip)
Skip characters in the stream. |
static long |
skipFully(java.io.InputStream in,
long charsToSkip)
Skip the requested number of characters from the stream. |
static long |
skipUntilEOF(java.io.InputStream in)
Skip until the end-of-stream is reached. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
private UTF8Util()
Method Detail |
---|
public static final long skipUntilEOF(java.io.InputStream in) throws java.io.IOException
in
- byte stream with UTF-8 encoded characters
java.io.IOException
- if reading from the stream fails
java.io.UTFDataFormatException
- if an invalid UTF-8 encoding is detectedpublic static final long skipFully(java.io.InputStream in, long charsToSkip) throws java.io.EOFException, java.io.IOException
in
- byte stream with UTF-8 encoded characterscharsToSkip
- number of characters to skip
java.io.EOFException
- if end-of-stream is reached before the requested
number of characters are skipped
java.io.IOException
- if reading from the stream fails
java.io.UTFDataFormatException
- if an invalid UTF-8 encoding is detectedprivate static final UTF8Util.SkipCount internalSkip(java.io.InputStream in, long charsToSkip) throws java.io.IOException
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,
Long.MAX_VALUE
could be passed as the requested number of
characters to skip.
in
- byte stream with UTF-8 encoded characterscharsToSkip
- the number of characters to skip
CHAR_COUNT
, the bytes skipped at position
BYTE_COUNT
. Note that the number of characters skipped
may be smaller than the requested number.
java.io.IOException
- if reading from the stream fails
java.io.UTFDataFormatException
- if an invalid UTF-8 encoding is detected
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |