Package org.java_websocket.util
Class Charsetfunctions
java.lang.Object
org.java_websocket.util.Charsetfunctions
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final CodingErrorAction
private static final int[]
Implementation of the "Flexible and Economical UTF-8 Decoder" algorithm by Björn Höhrmann (http://bjoern.hoehrmann.de/utf-8/decoder/dfa/) -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private constructor for real static class -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
asciiBytes
(String s) static boolean
isValidUTF8
(ByteBuffer data) Calling isValidUTF8 with offset 0static boolean
isValidUTF8
(ByteBuffer data, int off) Check if the provided BytebBuffer contains a valid utf8 encoded string.static String
stringAscii
(byte[] bytes) static String
stringAscii
(byte[] bytes, int offset, int length) static String
stringUtf8
(byte[] bytes) static String
stringUtf8
(ByteBuffer bytes) static byte[]
-
Field Details
-
codingErrorAction
-
utf8d
private static final int[] utf8dImplementation of the "Flexible and Economical UTF-8 Decoder" algorithm by Björn Höhrmann (http://bjoern.hoehrmann.de/utf-8/decoder/dfa/)
-
-
Constructor Details
-
Charsetfunctions
private Charsetfunctions()Private constructor for real static class
-
-
Method Details
-
utf8Bytes
-
asciiBytes
-
stringAscii
-
stringAscii
-
stringUtf8
- Throws:
InvalidDataException
-
stringUtf8
- Throws:
InvalidDataException
-
isValidUTF8
Check if the provided BytebBuffer contains a valid utf8 encoded string.Using the algorithm "Flexible and Economical UTF-8 Decoder" by Björn Höhrmann (http://bjoern.hoehrmann.de/utf-8/decoder/dfa/)
- Parameters:
data
- the ByteBufferoff
- offset (for performance reasons)- Returns:
- does the ByteBuffer contain a valid utf8 encoded string
-
isValidUTF8
Calling isValidUTF8 with offset 0- Parameters:
data
- the ByteBuffer- Returns:
- does the ByteBuffer contain a valid utf8 encoded string
-