Package org.rypt.f8
Interface Utf8Handler<X extends Exception>
-
- All Superinterfaces:
Utf8ByteHandler<X>
- All Known Implementing Classes:
Utf8Statistics,Utf8StringBuilder
public interface Utf8Handler<X extends Exception> extends Utf8ByteHandler<X>
Base interface for handling a stream of unicode code points and errors- Author:
- Hans Brende (hansbrende@apache.org)
-
-
Field Summary
-
Fields inherited from interface org.rypt.f8.Utf8ByteHandler
END_OF_STREAM
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidhandle1ByteCodePoint(int ascii)Called when a valid 1-byte sequence is encountered.default voidhandle2ByteCodePoint(int b1, int b2)Called when a valid 2-byte sequence is encountered.default voidhandle3ByteCodePoint(int b1, int b2, int b3)Called when a valid 3-byte sequence is encountered.default voidhandle4ByteCodePoint(int b1, int b2, int b3, int b4)Called when a valid 4-byte sequence is encountered.voidhandleCodePoint(int codePoint)Called when a valid unicode code point is encountereddefault voidhandleContinuationError(int b1, int nextByte)Called when an invalid continuation byte is encountered in a 2, 3, or 4-byte sequence.default voidhandleContinuationError(int b1, int b2, int nextByte)Called when an invalid continuation byte is encountered in a 3 or 4-byte sequence.default voidhandleContinuationError(int b1, int b2, int b3, int nextByte)Called when an invalid continuation byte is encountered in a 4-byte sequence.voidhandleError()Called when an invalid UTF-8 byte sequence is detecteddefault voidhandlePrefixError(int b1)Called when an invalid prefix byte is encountered.static Utf8Handler<IOException>of(Appendable writer)-
Methods inherited from interface org.rypt.f8.Utf8ByteHandler
handleIgnoredByte
-
-
-
-
Method Detail
-
handleCodePoint
void handleCodePoint(int codePoint) throws X extends ExceptionCalled when a valid unicode code point is encountered
-
handleError
void handleError() throws X extends ExceptionCalled when an invalid UTF-8 byte sequence is detected
-
handle1ByteCodePoint
default void handle1ByteCodePoint(int ascii) throws X extends ExceptionDescription copied from interface:Utf8ByteHandlerCalled when a valid 1-byte sequence is encountered.- Specified by:
handle1ByteCodePointin interfaceUtf8ByteHandler<X extends Exception>- Parameters:
ascii- the valid ASCII character encountered, in the range 0-0x7F- Throws:
X extends Exception
-
handle2ByteCodePoint
default void handle2ByteCodePoint(int b1, int b2) throws X extends ExceptionDescription copied from interface:Utf8ByteHandlerCalled when a valid 2-byte sequence is encountered.- Specified by:
handle2ByteCodePointin interfaceUtf8ByteHandler<X extends Exception>- 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
default void handle3ByteCodePoint(int b1, int b2, int b3) throws X extends ExceptionDescription copied from interface:Utf8ByteHandlerCalled when a valid 3-byte sequence is encountered.- Specified by:
handle3ByteCodePointin interfaceUtf8ByteHandler<X extends Exception>- 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
default void handle4ByteCodePoint(int b1, int b2, int b3, int b4) throws X extends ExceptionDescription copied from interface:Utf8ByteHandlerCalled when a valid 4-byte sequence is encountered.- Specified by:
handle4ByteCodePointin interfaceUtf8ByteHandler<X extends Exception>- 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)
-
handleContinuationError
default void handleContinuationError(int b1, int nextByte) throws X extends ExceptionDescription copied from interface:Utf8ByteHandlerCalled when an invalid continuation byte is encountered in a 2, 3, or 4-byte sequence.- Specified by:
handleContinuationErrorin interfaceUtf8ByteHandler<X extends Exception>- Parameters:
b1- the prefix bytenextByte- the invalid first continuation byte, orUtf8ByteHandler.END_OF_STREAMto indicate the end of the byte stream- Throws:
X extends Exception
-
handleContinuationError
default void handleContinuationError(int b1, int b2, int nextByte) throws X extends ExceptionDescription copied from interface:Utf8ByteHandlerCalled when an invalid continuation byte is encountered in a 3 or 4-byte sequence.- Specified by:
handleContinuationErrorin interfaceUtf8ByteHandler<X extends Exception>- Parameters:
b1- the prefix byteb2- the first continuation bytenextByte- the invalid second continuation byte, orUtf8ByteHandler.END_OF_STREAMto indicate the end of the byte stream- Throws:
X extends Exception
-
handleContinuationError
default void handleContinuationError(int b1, int b2, int b3, int nextByte) throws X extends ExceptionDescription copied from interface:Utf8ByteHandlerCalled when an invalid continuation byte is encountered in a 4-byte sequence.- Specified by:
handleContinuationErrorin interfaceUtf8ByteHandler<X extends Exception>- Parameters:
b1- the prefix byteb2- the first continuation byteb3- the second continuation bytenextByte- the invalid third continuation byte, orUtf8ByteHandler.END_OF_STREAMto indicate the end of the byte stream- Throws:
X extends Exception
-
handlePrefixError
default void handlePrefixError(int b1) throws X extends ExceptionDescription copied from interface:Utf8ByteHandlerCalled when an invalid prefix byte is encountered.- Specified by:
handlePrefixErrorin interfaceUtf8ByteHandler<X extends Exception>- Parameters:
b1- the invalid prefix byte, in the range (byte)0x80-(byte)0xC1 or (byte)0xF5-(byte)0xFF- Throws:
X extends Exception
-
of
static Utf8Handler<IOException> of(Appendable writer)
-
-