Package org.apache.calcite.util
Class SerializableCharset
- java.lang.Object
-
- org.apache.calcite.util.SerializableCharset
-
- All Implemented Interfaces:
java.io.Serializable
public class SerializableCharset extends java.lang.Object implements java.io.Serializable
Serializable wrapper around aCharset
.It serializes itself by writing out the name of the character set, for example "ISO-8859-1". On the other side, it deserializes itself by looking for a charset with the same name.
A SerializableCharset is immutable.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.charset.Charset
charset
private java.lang.String
charsetName
-
Constructor Summary
Constructors Modifier Constructor Description private
SerializableCharset(java.nio.charset.Charset charset)
Creates a SerializableCharset.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SerializableCharset
forCharset(java.nio.charset.Charset charset)
Returns a SerializableCharset wrapping the given Charset, or null if thecharset
is null.java.nio.charset.Charset
getCharset()
Returns the wrappedCharset
.private void
readObject(java.io.ObjectInputStream in)
PerSerializable
.private void
writeObject(java.io.ObjectOutputStream out)
PerSerializable
.
-
-
-
Constructor Detail
-
SerializableCharset
private SerializableCharset(java.nio.charset.Charset charset)
Creates a SerializableCharset. External users should callforCharset(Charset)
.- Parameters:
charset
- Character set; must not be null
-
-
Method Detail
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
PerSerializable
.- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
PerSerializable
.- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
getCharset
public java.nio.charset.Charset getCharset()
Returns the wrappedCharset
.- Returns:
- the wrapped Charset
-
forCharset
public static SerializableCharset forCharset(java.nio.charset.Charset charset)
Returns a SerializableCharset wrapping the given Charset, or null if thecharset
is null.- Parameters:
charset
- Character set to wrap, or null- Returns:
- Wrapped charset
-
-