class ForkObjectInputStream
extends java.io.ObjectInputStream
Note that this functionality could easily be implemented as a simple
anonymous ObjectInputStream
subclass, but since the
functionality is needed during the somewhat complicated bootstrapping
of the stdin/out communication channel of a forked server process,
it's better if class has a stable name that can be referenced at
compile-time by the ForkClient
class.
Modifier and Type | Field and Description |
---|---|
private java.lang.ClassLoader |
loader
The class loader used when deserializing objects.
|
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
Constructor and Description |
---|
ForkObjectInputStream(java.io.InputStream input,
java.lang.ClassLoader loader)
Creates a new object input stream that uses the given class loader
when deserializing objects.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
readObject(java.io.DataInputStream input,
java.lang.ClassLoader loader)
Deserializes an object from the given stream.
|
protected java.lang.Class<?> |
resolveClass(java.io.ObjectStreamClass desc)
Loads the identified class from the specified class loader.
|
static void |
sendObject(java.lang.Object object,
java.io.DataOutputStream output)
Serializes the object first into an in-memory buffer and then
writes it to the output stream with a preceding size integer.
|
available, close, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readChar, readClassDescriptor, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readStreamHeader, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, resolveProxyClass, skipBytes
private final java.lang.ClassLoader loader
public ForkObjectInputStream(java.io.InputStream input, java.lang.ClassLoader loader) throws java.io.IOException
input
- underlying input streamloader
- class loader used when deserializing objectsjava.io.IOException
- if this stream could not be initiatedprotected java.lang.Class<?> resolveClass(java.io.ObjectStreamClass desc) throws java.lang.ClassNotFoundException
resolveClass
in class java.io.ObjectInputStream
desc
- class descriptionjava.lang.ClassNotFoundException
- if the class can not be foundpublic static void sendObject(java.lang.Object object, java.io.DataOutputStream output) throws java.io.IOException
object
- object to be serializedoutput
- output streamjava.io.IOException
- if the object could not be serializedpublic static java.lang.Object readObject(java.io.DataInputStream input, java.lang.ClassLoader loader) throws java.io.IOException, java.lang.ClassNotFoundException
input
- input stream from which the serialized object is readloader
- class loader to be used for loading referenced classesjava.io.IOException
- if the object could not be deserializedjava.lang.ClassNotFoundException
- if a referenced class is not found