ObjectInputStream (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Closeable, DataInput, ObjectInput, ObjectStreamConstants, AutoCloseable
-
Nested Class Summary
Nested Classes
static classProvide access to the persistent fields read from the input stream.
-
Field Summary
Fields declared in interface ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, SERIAL_FILTER_PERMISSION, 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_STRINGstatic final intFirst wire handle to be assigned.
static final intA Stream Protocol Version.
static final intA Stream Protocol Version.
static final byteBit mask for ObjectStreamClass flag.
static final byteBit mask for ObjectStreamClass flag.
static final byteBit mask for ObjectStreamClass flag.
static final byteBit mask for ObjectStreamClass flag.
static final byteBit mask for ObjectStreamClass flag.
Enable setting the system-wide serial filter.
static final shortMagic number that is written to the stream header.
static final shortVersion number that is written to the stream header.
Enable overriding of readObject and writeObject.
Enable substitution of one object for another during serialization/deserialization.
static final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final byteEnd of optional block data blocks for an object.
static final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final bytenew Proxy Class Descriptor.
static final byteReference to an object already written into the stream.
static final bytestatic final byte -
Constructor Summary
Constructors
protectedProvide a way for subclasses that are completely reimplementing ObjectInputStream to not have to allocate private data just used by this implementation of ObjectInputStream.
Creates an ObjectInputStream that reads from the specified InputStream.
-
Method Summary
intReturns the number of bytes that can be read without blocking.
voidclose()Closes this input stream and releases any system resources associated with the stream.
voidRead the non-static and non-transient fields of the current class from this stream.
protected booleanenableResolveObject(boolean enable) Enables the stream to do replacement of objects read from the stream.
Returns the deserialization filter for this stream.
intread()intread(byte[] buf, int off, int len) Reads into an array of bytes.
booleanbytereadByte()charreadChar()Read a class descriptor from the serialization stream.
doubleReads the persistent fields from the stream and makes them available by name.
floatvoidreadFully(byte[] buf) Reads bytes, blocking until all bytes are read.
voidreadFully(byte[] buf, int off, int len) Reads bytes, blocking until all bytes are read.
intreadInt()readLine()longreadLong()Read an object from the ObjectInputStream.
This method is called by trusted subclasses of ObjectInputStream that constructed ObjectInputStream using the protected no-arg constructor.
shortprotected voidThe readStreamHeader method is provided to allow subclasses to read and verify their own stream headers.
Reads an "unshared" object from the ObjectInputStream.
intReads an unsigned 8-bit byte.
intReads an unsigned 16-bit short.
readUTF()voidRegister an object to be validated before the graph is returned.
Load the local class equivalent of the specified stream class description.
This method will allow trusted subclasses of ObjectInputStream to substitute one object for another during deserialization.
Returns a proxy class that implements the interfaces named in a proxy class descriptor; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes, allowing them to use an alternate loading mechanism for the interfaces and the proxy class.
final voidSet the deserialization filter for the stream.
intskipBytes(int len) Methods declared in class InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTovoidmark(int readlimit) Marks the current position in this input stream.
booleanTests if this input stream supports the
markandresetmethods.Returns a new
InputStreamthat reads no bytes.intReads some number of bytes from the input stream and stores them into the buffer array
b.byte[]Reads all remaining bytes from the input stream.
intReads the requested number of bytes from the input stream into the given byte array.
byte[]Reads up to a specified number of bytes from the input stream.
voidRepositions this stream to the position at the time the
markmethod was last called on this input stream.longSkips over and discards
nbytes of data from this input stream.voidSkips over and discards exactly
nbytes of data from this input stream.longReads all bytes from this input stream and writes the bytes to the given output stream in the order that they are read.
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitCreates and returns a copy of this object.
booleanIndicates whether some other object is "equal to" this one.
protected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.intReturns a hash code value for this object.
final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
Returns a string representation of the object.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
ObjectInputStream
-
ObjectInputStream
-
-
Method Details
-
readObject
-
readObjectOverride
-
defaultReadObject
-
readFields
-
registerValidation
-
resolveClass
-
resolveProxyClass
-
resolveObject
-
enableResolveObject
-
readClassDescriptor
-
read
-
read
-
available
-
close
-
readBoolean
-
readByte
-
readUnsignedByte
-
readChar
-
readShort
-
readUnsignedShort
-
readInt
-
readLong
-
readFloat
-
readDouble
-
readFully
-
readFully
-
skipBytes
-
readLine
-
readUTF
-
getObjectInputFilter
-
setObjectInputFilter
-