|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.DataInputStream
com.threerings.io.ObjectInputStream
public class ObjectInputStream
Used to read Streamable objects from an InputStream. Other common object types
are supported as well (@see ObjectOutputStream).
Streamable| Field Summary | |
|---|---|
protected List<com.threerings.io.ClassMapping> |
_classmap
Used to map classes to numeric codes and the Streamer instance used to write
them. |
protected Object |
_current
The object currently being read from the stream. |
protected List<String> |
_internmap
Maps numeric codes to pooled strings. |
protected ClassLoader |
_loader
If set, an overridden class loader used to instantiate objects. |
protected Streamer |
_streamer
The streamer being used currently. |
protected Map<String,String> |
_translations
An optional set of class name translations to use when unserializing objects. |
protected static boolean |
STREAM_DEBUG
Used to activate verbose debug logging. |
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
ObjectInputStream(InputStream source)
Constructs an object input stream which will read its data from the supplied source stream. |
|
| Method Summary | |
|---|---|
void |
addTranslation(String oldname,
String newname)
Configures this object input stream with a mapping from an old class name to a new one. |
protected com.threerings.io.ClassMapping |
createClassMapping(short code,
String cname)
Creates and returns a class mapping for the specified code and class name. |
void |
defaultReadObject()
Reads the fields of the specified Streamable instance from the input stream using
the default object streaming mechanisms (a call is not made to readObject(),
even if such a method exists). |
protected com.threerings.io.ClassMapping |
mapClass(short code,
String cname)
Creates, adds, and returns the class mapping for the specified code and class name. |
protected void |
mapIntern(short code,
String value)
Adds the intern mapping for the specified code and value. |
void |
readBareObject(Object object)
Reads an object from the input stream that was previously written with ObjectOutputStream.writeBareObject(Object). |
protected void |
readBareObject(Object object,
Streamer streamer,
boolean useReader)
Reads an object from the input stream that was previously written with ObjectOutputStream.writeBareObject(Object,Streamer,boolean). |
protected com.threerings.io.ClassMapping |
readClassMapping()
Reads a class mapping from the stream. |
String |
readIntern()
Reads a pooled string value from the input stream. |
Object |
readObject()
Reads a Streamable instance or one of the supported object types from the input
stream. |
String |
readUnmodifiedUTF()
Read a string encoded as real UTF-8 (rather than the modified format handled by {link #readUTF}). |
void |
setClassLoader(ClassLoader loader)
Customizes the class loader used to instantiate objects read from the input stream. |
String |
toString()
|
| Methods inherited from class java.io.DataInputStream |
|---|
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes |
| Methods inherited from class java.io.FilterInputStream |
|---|
available, close, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected List<com.threerings.io.ClassMapping> _classmap
Streamer instance used to write
them.
protected List<String> _internmap
protected Object _current
protected Streamer _streamer
protected ClassLoader _loader
protected Map<String,String> _translations
protected static final boolean STREAM_DEBUG
| Constructor Detail |
|---|
public ObjectInputStream(InputStream source)
| Method Detail |
|---|
public void setClassLoader(ClassLoader loader)
public void addTranslation(String oldname,
String newname)
public Object readObject()
throws IOException,
ClassNotFoundException
Streamable instance or one of the supported object types from the input
stream.
IOException
ClassNotFoundException
public String readIntern()
throws IOException
IOException
protected void mapIntern(short code,
String value)
throws IOException
IOException
protected com.threerings.io.ClassMapping readClassMapping()
throws IOException,
ClassNotFoundException
null to represent a null value.
IOException
ClassNotFoundException
protected com.threerings.io.ClassMapping mapClass(short code,
String cname)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundException
protected com.threerings.io.ClassMapping createClassMapping(short code,
String cname)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundException
public void readBareObject(Object object)
throws IOException,
ClassNotFoundException
ObjectOutputStream.writeBareObject(Object).
object - the object to be populated from data on the stream. It cannot be
null.
IOException
ClassNotFoundException
protected void readBareObject(Object object,
Streamer streamer,
boolean useReader)
throws IOException,
ClassNotFoundException
ObjectOutputStream.writeBareObject(Object,Streamer,boolean).
IOException
ClassNotFoundException
public void defaultReadObject()
throws IOException,
ClassNotFoundException
Streamable instance from the input stream using
the default object streaming mechanisms (a call is not made to readObject(),
even if such a method exists).
IOException
ClassNotFoundException
public String readUnmodifiedUTF()
throws IOException
IOExceptionpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||