Package org.postgresql.core
Class ByteOptimizedUTF8Encoder
- java.lang.Object
-
- org.postgresql.core.Encoding
-
- org.postgresql.core.OptimizedUTF8Encoder
-
- org.postgresql.core.ByteOptimizedUTF8Encoder
-
final class ByteOptimizedUTF8Encoder extends OptimizedUTF8Encoder
UTF-8 encoder which validates input and is optimized for jdk 9+ whereStringobjects are backed bybyte[].
-
-
Field Summary
Fields Modifier and Type Field Description private static java.nio.charset.CharsetASCII_CHARSET-
Fields inherited from class org.postgresql.core.OptimizedUTF8Encoder
UTF_8_CHARSET
-
-
Constructor Summary
Constructors Constructor Description ByteOptimizedUTF8Encoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringdecode(byte[] encodedString, int offset, int length)Decode an array of bytes into a string.private java.lang.StringslowDecode(byte[] encodedString, int offset, int length, int curIdx)Decodes tochar[]in presence of non-ascii values after first copying all known ascii chars directly frombyte[]tochar[].-
Methods inherited from class org.postgresql.core.OptimizedUTF8Encoder
charDecode, decodeToChars, getCharArray
-
Methods inherited from class org.postgresql.core.Encoding
decode, defaultEncoding, encode, getDatabaseEncoding, getDecodingReader, getEncodingWriter, getJVMEncoding, hasAsciiNumbers, name, toString
-
-
-
-
Method Detail
-
decode
public java.lang.String decode(byte[] encodedString, int offset, int length) throws java.io.IOExceptionDecode an array of bytes into a string.- Overrides:
decodein classEncoding- Parameters:
encodedString- a byte array containing the string to decodeoffset- the offset inencodedStringof the first byte of the encoded representationlength- the length, in bytes, of the encoded representation- Returns:
- the decoded string
- Throws:
java.io.IOException- if something goes wrong
-
slowDecode
private java.lang.String slowDecode(byte[] encodedString, int offset, int length, int curIdx) throws java.io.IOExceptionDecodes tochar[]in presence of non-ascii values after first copying all known ascii chars directly frombyte[]tochar[].- Throws:
java.io.IOException
-
-