Last Updated : 23 Jul, 2025
Java.io.ObjectInputStream Class in Java | Set 1
Note :
Java codes mentioned in this article won't run on Online IDE as the file used in the code doesn't exists online. So, to verify the working of the codes, you can copy them to your System and can run it over there.
More Methods of ObjectInputStream Class :
public void defaultReadObject() Parameters : ----------- Return : void Exception : -> IOException : in case of any IO error occurs. -> ClassNotFoundException : if the class of Object(being serialized) is not found -> NotActiveException : if the Stream is not reading.
public void defaultReadObject() Parameters : public final Object readObject() Return : void Exception : -> IOException : in case of any IO error occurs. -> ClassNotFoundException : if the class of Object(being serialized) is not found -> OptionalDataException : if instead of object, primitive data is found. -> InvalidClassException : is there is something wrong with serialized class
public int available() Parameters : ----------- Return : no. of bytes of that can be read without being blocked Exception : -> IOException : in case of any IO error occurs.
public void close() Parameters : ----------- Return : void Exception : -> IOException : in case of any IO error occurs.
public short readShort() Parameters : public final Object readObject() Return : reads 16 bit short. Exception : -> IOException : in case of any IO error occurs. -> EOFException : if End of stream is reached
public String readUTF() Parameters : public final Object readObject() Return : reads String in modified UTF-8 (Unicode Transformation Format) format Exception : -> IOException : in case of any IO error occurs.
public int skipBytes(int maxlen) Parameters : maxlen : max. no. of bytes to be skipped Return : no. of bytes to be skipped Exception : -> IOException : in case of any IO error occurs.
public void readFully(byte[] destination) Parameters : destination : the buffer in which the data is to be read Return : returns the 32 bit float read Exception : -> IOException : in case of any IO error occurs. -> EOFException : if End of stream is reached
public void readFully(byte[] destination, int offset, int maxlen) Parameters : destination : the buffer in which the data is to be read offset : starting position of the buffer maxlen : max no. of bytes to be read Return : void Exception : -> IOException : in case of any IO error occurs. -> EOFException : if End of stream is reached
public ObjectInputStream.GetField readFields() Parameters : ------- Return : GetField object reading the constant fields Exception : -> IOException : in case of any IO error occurs. -> ClassNotFoundException : if class of serialized object is not found
protected Class resolveClass(ObjectStreamClass desc) : means that the class object can be of any type, it is to be specified by the coder. Parameters : INS_class : instance of the specified Stream Class Return : Class Object equivalent to the Specified Stream Class Exception : -> IO Exception : if any IO exception occurs -> ClassNotFoundException : if the argumented class is not available.
public void registerValidation(ObjectInputValidation object, int order) Parameters : ------- Return : object : object to be validated order : Controls the order of callback. These are processed in no particular order Exception : -> NotActiveException : If IO stream is not ready to be read -> InvalidObjectException : if the argumented object to be validated is NULL.
protected Object resolveObject(Object o) Parameters : o : object we want to substitute Return : --------- Exception : -> IOException : If IO error occurs.
protected boolean enableResolveObject(boolean enable) Parameters : check : "true" to allow resolveObject() method Return : ----
protected ObjectStreamClass readClassDescriptor() Parameters : ------- Return : reads class descriptor
protected Object readObjectOverride() Parameters : ------- Return : reads object from the Stream
protected void readStreamHeader() Parameters : ------- Return : void
protected Class resolveProxyClass(String[] in_list) Parameters : in_List : interface names list, deserialized in the proxy class descriptor Return : Proxy class for specific Interface mentioned in the list
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4