public interface Encoding
Encoding translates between a Java string and a byte array for a specific (Firebird) encoding.
Encoding implementations need to be thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptioncreateReader
(InputStream inputStream) Creates a reader wrapping an input stream.createWriter
(OutputStream outputStream) Creates a writer wrapping an input stream.decodeFromCharset
(byte[] in) Decodes the supplied byte array to a String.decodeFromCharset
(byte[] in, int offset, int length) Decodes a part of the supplied byte array to a String.byte[]
Encodes the supplied String to bytes in this encoding.
-
Method Details
-
encodeToCharset
Encodes the supplied String to bytes in this encoding.- Parameters:
in
- String to encode- Returns:
- Byte array with encoded string
-
decodeFromCharset
Decodes the supplied byte array to a String.- Parameters:
in
- byte array to decode- Returns:
- String after decoding the byte array
-
decodeFromCharset
Decodes a part of the supplied byte array to a String.- Parameters:
in
- byte array to decodeoffset
- Offset into the byte arraylength
- Length in bytes to decode- Returns:
- String after decoding the byte array
-
getCharsetName
String getCharsetName()- Returns:
- The name of the Java character set.
-
createReader
Creates a reader wrapping an input stream.- Parameters:
inputStream
- Input stream- Returns:
- Reader applying this encoding when reading
-
createWriter
Creates a writer wrapping an input stream.- Parameters:
outputStream
- Input stream- Returns:
- Writer applying this encoding when writing
-