Package org.firebirdsql.encodings
Interface Encoding
-
public interface EncodingEncoding translates between a Java string and a byte array for a specific (Firebird) encoding.Encoding implementations need to be thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.io.ReadercreateReader(java.io.InputStream inputStream)Creates a reader wrapping an input stream.java.io.WritercreateWriter(java.io.OutputStream outputStream)Creates a writer wrapping an input stream.java.lang.StringdecodeFromCharset(byte[] in)Decodes the supplied byte array to a String.java.lang.StringdecodeFromCharset(byte[] in, int offset, int length)Decodes a part of the supplied byte array to a String.byte[]encodeToCharset(java.lang.String in)Encodes the supplied String to bytes in this encoding.java.lang.StringgetCharsetName()
-
-
-
Method Detail
-
encodeToCharset
byte[] encodeToCharset(java.lang.String in)
Encodes the supplied String to bytes in this encoding.- Parameters:
in- String to encode- Returns:
- Byte array with encoded string
-
decodeFromCharset
java.lang.String decodeFromCharset(byte[] in)
Decodes the supplied byte array to a String.- Parameters:
in- byte array to decode- Returns:
- String after decoding the byte array
-
decodeFromCharset
java.lang.String decodeFromCharset(byte[] in, int offset, int length)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
java.lang.String getCharsetName()
- Returns:
- The name of the Java character set.
-
createReader
java.io.Reader createReader(java.io.InputStream inputStream)
Creates a reader wrapping an input stream.- Parameters:
inputStream- Input stream- Returns:
- Reader applying this encoding when reading
-
createWriter
java.io.Writer createWriter(java.io.OutputStream outputStream)
Creates a writer wrapping an input stream.- Parameters:
outputStream- Input stream- Returns:
- Writer applying this encoding when writing
-
-