GeeksforGeeks
geeksforgeeks.org › java › difference-between-objectinputstream-and-objectoutputstream-in-java
Difference Between ObjectInputStream and ObjectOutputStream in Java - GeeksforGeeks
July 23, 2025 - In a software project, in many instances, there are necessities to transfer the data, and it can be handled by using ObjectOutputStream and ObjectInputStream from Java IO packages. Usually, the data is written in binary format and hence we cannot view the contents.
Videos
11:12
ObjectOutputStream, ObjectInputStream demonstrated in Java - YouTube
08:06
ObjectInputStream and ObjectOutputStream class in Java - CSE1007 ...
10:16
ObjectOutputStream and ObjectInputStream - YouTube
06:36
What is Java ObjectOutputStream? | Java Serialization | Java IO ...
06:06
What is Java ObjectInputStream? | Java Serialization | Java IO ...
Oracle
docs.oracle.com › javase › 8 › docs › api › java › io › ObjectInputStream.html
ObjectInputStream (Java Platform SE 8 )
April 21, 2026 - ObjectOutputStream and ObjectInputStream can provide an application with persistent storage for graphs of objects when used with a FileOutputStream and FileInputStream respectively. ObjectInputStream is used to recover those objects previously serialized.
Codespindle
codespindle.com › Java › Java_objectinputstream_Objectoutputstream.html
ObjectInputStream and ObjectOutputStream in Java
ObjectInputStream and ObjectOutputStream are two classes in Java that are used to serialize and deserialize Java objects, respectively. Serialization is the process of converting a Java object into a stream of bytes that can be stored or transmitted. Deserialization is the process of converting ...
Oracle
docs.oracle.com › javase › 7 › docs › api › java › io › ObjectInputStream.html
ObjectInputStream (Java Platform SE 7 )
ObjectOutputStream and ObjectInputStream can provide an application with persistent storage for graphs of objects when used with a FileOutputStream and FileInputStream respectively. ObjectInputStream is used to recover those objects previously serialized.
Programiz
programiz.com › java-programming › objectinputstream
Java ObjectInputStream (With Examples)
In the above example, we have used the readInt() and readObject() method to read integer data and object data from the file. Here, we have used the ObjectOutputStream to write data to the file. We then read the data from the file using the ObjectInputStream. ... import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; class Dog implements Serializable { String name; String breed; public Dog(String name, String breed) { this.name = name; this.breed = breed; } } class Main { public static vo
CodeJava
codejava.net › java-se › file-io › java-io-objectinputstream-and-objectoutputstream-examples
Java IO ObjectInputStream and ObjectOutputStream Examples
July 28, 2019 - [Master REST API Development and Java and Spring Boot] This Java File IO tutorial helps you understand and use the object streams classes ObjectInputStream and ObjectOutputStream in the Java File I/O API.You use object streams to read and write Java objects in binary format.
Programiz
programiz.com › java-programming › objectoutputstream
Java ObjectOutputStream (With Examples)
ObjectInputStream named objIn using the FileInputStream named fileIn. An object dog1 of the Dog class. Here, we have then used the object output stream to write the object to the file. And, the object input stream to read the object from the file. Note: The Dog class implements the Serializable interface. It is because the ObjectOutputStream only writes objects that can be serialized to the output stream. To learn more, visit Java ObjectOutputStream (official Java documentation).
Stack Overflow
stackoverflow.com › questions › 72163777 › using-objectoutputstream-and-objectinputstream-in-java-displaying-the-data-in-t
Using ObjectOutputStream and ObjectInputStream in java, displaying the data in the file line by line on the screen - Stack Overflow
java.io.EOFException at java.base/java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:3159) at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1640) at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:495) at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:453) at Student.StudentServices.list(StudentServices.java:19) at Main.MainTest.menu(MainTest.java:47) at Main.MainTest.main(MainTest.java:14)*
Javatpoint
javatpoint.com › java-objectinputstream
Java ObjectInputStream - Javatpoint
The objectinputstream class is mainly used to deserialize the primitive data and objects which are written by using ObjectOutputStream. ObjectInputStream can also be used to pass the objects between hosts by using a SocketStream. The objects which implement Serializable or Externalizable interface ...
GeeksforGeeks
geeksforgeeks.org › java › java-io-objectinputstream-class-java-set-1
Java.io.ObjectInputStream Class in Java | Set 1 - GeeksforGeeks
July 6, 2023 - Both ObjectOutputStream and ObjectInputStream are used as it provides storage for graphs of object. It ensures that the object it is working for, matches the classes of JVM i.e Java Virtual Machine.
Oracle
docs.oracle.com › javase › tutorial › essential › io › objectstreams.html
Object Streams (The Java™ Tutorials > Essential Java Classes > Basic I/O)
The object stream classes are ObjectInputStream and ObjectOutputStream. These classes implement ObjectInput and ObjectOutput, which are subinterfaces of DataInput and DataOutput. That means that all the primitive data I/O methods covered in Data Streams are also implemented in object streams.
Bureau of Economic Geology
beg.utexas.edu › lmod › agi.servlet › doc › detail › java › io › ObjectInputStream.html
java.io Class ObjectInputStream
No-arg constructors are invoked for the non-serializable classes and then the fields of the serializable classes are restored from the stream starting with the serializable class closest to java.lang.object and finishing with the object's most specifiec class. For example to read from a stream as written by the example in ObjectOutputStream: FileInputStream istream = new FileInputStream("t.tmp"); ObjectInputStream p = new ObjectInputStream(istream); int i = p.readInt(); String today = (String)p.readObject(); Date date = (Date)p.readObject(); istream.close(); Classes control how they are serialized by implementing either the java.io.Serializable or java.io.Externalizable interfaces.
Oracle
docs.oracle.com › javase › 9 › docs › api › java › io › ObjectInputStream.html
ObjectInputStream (Java SE 9 & JDK 9 )
ObjectOutputStream and ObjectInputStream can provide an application with persistent storage for graphs of objects when used with a FileOutputStream and FileInputStream respectively. ObjectInputStream is used to recover those objects previously serialized.
Top answer 1 of 4
3
Using object streams over sockets is not really a recommended idea. You might consider a full web service, or RMI.
It might work better if you read into a buffer and make sure that you have the whole business before trying to deserialize with the object streams.
2 of 4
2
Why not use hessian library?
It works like a charm: http://karussell.wordpress.com/2009/04/10/hessian-web-service-protocol-hello-world-example/
Or try spring remoting (which is not that lightweight)
http://static.springsource.org/spring/docs/2.5.x/reference/remoting.html