org.eigenbase.util
Class SerializableCharset

java.lang.Object
  extended by org.eigenbase.util.SerializableCharset
All Implemented Interfaces:
Serializable

public class SerializableCharset
extends Object
implements Serializable

Serializable wrapper around a Charset.

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.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/util/SerializableCharset.java#4 $
Author:
jhyde
See Also:
Serialized Form

Field Summary
private  Charset charset
           
private  String charsetName
           
 
Constructor Summary
private SerializableCharset(Charset charset)
          Creates a SerializableCharset.
 
Method Summary
static SerializableCharset forCharset(Charset charset)
          Returns a SerializableCharset wrapping the given Charset, or null if the charset is null.
 Charset getCharset()
          Returns the wrapped Charset.
private  void readObject(ObjectInputStream in)
          Per Serializable.
private  void writeObject(ObjectOutputStream out)
          Per Serializable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

charset

private Charset charset

charsetName

private String charsetName
Constructor Detail

SerializableCharset

private SerializableCharset(Charset charset)
Creates a SerializableCharset. External users should call forCharset(Charset).

Parameters:
charset - Character set; must not be null
Method Detail

writeObject

private void writeObject(ObjectOutputStream out)
                  throws IOException
Per Serializable.

Throws:
IOException

readObject

private void readObject(ObjectInputStream in)
                 throws IOException,
                        ClassNotFoundException
Per Serializable.

Throws:
IOException
ClassNotFoundException

getCharset

public Charset getCharset()
Returns the wrapped Charset.

Returns:
the wrapped Charset

forCharset

public static SerializableCharset forCharset(Charset charset)
Returns a SerializableCharset wrapping the given Charset, or null if the charset is null.

Parameters:
charset - Character set to wrap, or null
Returns:
Wrapped charset