polyglot.util
Class TypeEncoder
java.lang.Object
polyglot.util.TypeEncoder
public class TypeEncoder
- extends java.lang.Object
The TypeEncoder
gives the ability to encode a polyglot
Type
as a Java string.
It uses a form of serialization to encode the Type
into
a byte stream and then converts the byte stream to a standard Java string.
The difference between the encoder and a normal serialization process is
that in order to encode this type, we need to sever any links to other types
in the current environment. So any ClassType
other than the
the type being encoded is replaced in the stream with a
PlaceHolder
that contains the name of the class. To aid
in the decoding process, placeholders for member classes user their
"mangled" name; non-member classes use their fully qualified name.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ts
protected TypeSystem ts
zip
protected final boolean zip
- See Also:
- Constant Field Values
base64
protected final boolean base64
- See Also:
- Constant Field Values
test
protected final boolean test
- See Also:
- Constant Field Values
TypeEncoder
public TypeEncoder(TypeSystem ts)
encode
public java.lang.String encode(Type t)
throws java.io.IOException
- Throws:
java.io.IOException
decode
public Type decode(java.lang.String s)
throws java.io.InvalidClassException
- Throws:
java.io.InvalidClassException