Package org.rypt.f8
Interface Utf8ByteHandler<X extends Exception>
-
- All Known Subinterfaces:
Utf8Handler<X>
- All Known Implementing Classes:
Utf8Statistics,Utf8StringBuilder
public interface Utf8ByteHandler<X extends Exception>Base interface for handling a UTF-8 encoded byte stream- Author:
- Hans Brende (hansbrende@apache.org)
-
-
Field Summary
Fields Modifier and Type Field Description static intEND_OF_STREAMA flag to indicate the absence of a trailing continuation byte because the end of the stream has been reached, inhandleContinuationError(int, int),handleContinuationError(int, int, int), andhandleContinuationError(int, int, int, int)
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidhandle1ByteCodePoint(int b1)Called when a valid 1-byte sequence is encountered.voidhandle2ByteCodePoint(int b1, int b2)Called when a valid 2-byte sequence is encountered.voidhandle3ByteCodePoint(int b1, int b2, int b3)Called when a valid 3-byte sequence is encountered.voidhandle4ByteCodePoint(int b1, int b2, int b3, int b4)Called when a valid 4-byte sequence is encountered.voidhandleContinuationError(int b1, int err)Called when an invalid continuation byte is encountered in a 2, 3, or 4-byte sequence.voidhandleContinuationError(int b1, int b2, int err)Called when an invalid continuation byte is encountered in a 3 or 4-byte sequence.voidhandleContinuationError(int b1, int b2, int b3, int err)Called when an invalid continuation byte is encountered in a 4-byte sequence.default voidhandleIgnoredByte(int b)Called for a trailing byte in an invalid multi-byte sequence for which the error has already been handled, and thus, no action needs to be taken.voidhandlePrefixError(int err)Called when an invalid prefix byte is encountered.
-
-
-
Field Detail
-
END_OF_STREAM
static final int END_OF_STREAM
A flag to indicate the absence of a trailing continuation byte because the end of the stream has been reached, inhandleContinuationError(int, int),handleContinuationError(int, int, int), andhandleContinuationError(int, int, int, int)- See Also:
- Constant Field Values
-
-
Method Detail
-
handle1ByteCodePoint
void handle1ByteCodePoint(int b1) throws X extends ExceptionCalled when a valid 1-byte sequence is encountered.
-
handle2ByteCodePoint
void handle2ByteCodePoint(int b1, int b2) throws X extends ExceptionCalled when a valid 2-byte sequence is encountered.- Parameters:
b1- the prefix byte, in the range (byte)0xC2-(byte)0xDFb2- the continuation byte, in the range (byte)0x80-(byte)0xBF- Throws:
X extends Exception- See Also:
Utf8.codePoint(int, int)
-
handle3ByteCodePoint
void handle3ByteCodePoint(int b1, int b2, int b3) throws X extends ExceptionCalled when a valid 3-byte sequence is encountered.- Parameters:
b1- the prefix byte, in the range (byte)0xE0-(byte)0xEFb2- the first continuation byte, in the range (byte)0x80-(byte)0xBF, unless the prefix byte is (byte)0xED or (byte)0xE0, in which case the range is (byte)0x80-(byte)0x9F or (byte)0xA0-(byte)0xBF, respectivelyb3- the second continuation byte, in the range (byte)0x80-(byte)0xBF- Throws:
X extends Exception- See Also:
Utf8.codePoint(int, int, int)
-
handle4ByteCodePoint
void handle4ByteCodePoint(int b1, int b2, int b3, int b4) throws X extends ExceptionCalled when a valid 4-byte sequence is encountered.- Parameters:
b1- the prefix byte, in the range (byte)0xF0-(byte)0xF4b2- the first continuation byte, in the range (byte)0x80-(byte)0xBF, unless the prefix byte is (byte)0xF4 or (byte)0xF0, in which case the range is (byte)0x80-(byte)0x8F or (byte)0x90-(byte)0x9F, respectivelyb3- the second continuation byte, in the range (byte)0x80-(byte)0xBFb4- the third continuation byte, in the range (byte)0x80-(byte)0xBF- Throws:
X extends Exception- See Also:
Utf8.codePoint(int, int, int, int)
-
handlePrefixError
void handlePrefixError(int err) throws X extends ExceptionCalled when an invalid prefix byte is encountered.
-
handleContinuationError
void handleContinuationError(int b1, int err) throws X extends ExceptionCalled when an invalid continuation byte is encountered in a 2, 3, or 4-byte sequence.- Parameters:
b1- the prefix byteerr- the invalid first continuation byte, orEND_OF_STREAMto indicate the end of the byte stream- Throws:
X extends Exception
-
handleContinuationError
void handleContinuationError(int b1, int b2, int err) throws X extends ExceptionCalled when an invalid continuation byte is encountered in a 3 or 4-byte sequence.- Parameters:
b1- the prefix byteb2- the first continuation byteerr- the invalid second continuation byte, orEND_OF_STREAMto indicate the end of the byte stream- Throws:
X extends Exception
-
handleContinuationError
void handleContinuationError(int b1, int b2, int b3, int err) throws X extends ExceptionCalled when an invalid continuation byte is encountered in a 4-byte sequence.- Parameters:
b1- the prefix byteb2- the first continuation byteb3- the second continuation byteerr- the invalid third continuation byte, orEND_OF_STREAMto indicate the end of the byte stream- Throws:
X extends Exception
-
handleIgnoredByte
default void handleIgnoredByte(int b) throws X extends ExceptionCalled for a trailing byte in an invalid multi-byte sequence for which the error has already been handled, and thus, no action needs to be taken. This method is called for the second and third bytes in a 3-byte sequence corresponding to a surrogate code point.- Parameters:
b- the ignored byte- Throws:
X extends Exception- See Also:
Character.isSurrogate(char)
-
-