Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › io › ObjectInputStream.html
ObjectInputStream (Java SE 11 & JDK 11 )
January 20, 2026 - An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream. Warning: Deserialization of untrusted data is inherently dangerous and should be avoided. Untrusted data should be carefully validated according to the "Serialization and Deserialization" ...
Oracle
docs.oracle.com › javase › 8 › docs › api › java › io › ObjectInputStream.html
ObjectInputStream (Java Platform SE 8 )
April 21, 2026 - Read an object from the ObjectInputStream. The class of the object, the signature of the class, and the values of the non-transient and non-static fields of the class and all of its supertypes are read. Default deserializing for a class can be overridden using the writeObject and readObject methods.
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › io › ObjectOutputStream.html
ObjectOutputStream (Java SE 11 & JDK 11 )
October 20, 2025 - An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream. The objects can be read (reconstituted) using an ObjectInputStream. Persistent storage of objects can be accomplished by using a file for the stream.
GitHub
github.com › AdoptOpenJDK › openjdk-jdk11 › blob › master › src › java.base › share › classes › java › io › ObjectOutputStream.java
openjdk-jdk11/src/java.base/share/classes/java/io/ObjectOutputStream.java at master · AdoptOpenJDK/openjdk-jdk11
March 2, 2019 - * An ObjectOutputStream writes primitive data types and graphs of Java objects · * to an OutputStream. The objects can be read (reconstituted) using an · * ObjectInputStream. Persistent storage of objects can be accomplished by · * using a file for the stream.
Author AdoptOpenJDK
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › io › InputStream.html
InputStream (Java SE 11 & JDK 11 )
January 20, 2026 - java.io.InputStream · All Implemented Interfaces: Closeable, AutoCloseable · Direct Known Subclasses: AudioInputStream, ByteArrayInputStream, FileInputStream, FilterInputStream, ObjectInputStream, PipedInputStream, SequenceInputStream, StringBufferInputStream ·
Oracle
docs.oracle.com › en › java › javase › 22 › docs › api › java.base › java › io › ObjectInputStream.html
ObjectInputStream (Java SE 22 & JDK 22)
July 16, 2024 - The readObject method is responsible for reading and restoring the state of the object for its particular class using data written to the stream by the corresponding writeObject method. The method does not need to concern itself with the state belonging to its superclasses or subclasses. State is restored by reading data from the ObjectInputStream for the individual fields and making assignments to the appropriate fields of the object.
GitHub
github.com › AdoptOpenJDK › openjdk-jdk8u › blob › master › jdk › src › share › classes › java › io › ObjectInputStream.java
openjdk-jdk8u/jdk/src/share/classes/java/io/ObjectInputStream.java at master · AdoptOpenJDK/openjdk-jdk8u
September 29, 2021 - * <p>ObjectInputStream ensures that the types of all objects in the graph · * created from the stream match the classes present in the Java Virtual · * Machine. Classes are loaded as required using the standard mechanisms.
Author AdoptOpenJDK
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › io › ObjectInput.html
ObjectInput (Java SE 11 & JDK 11 )
January 20, 2026 - Package java.io · All Superinterfaces: AutoCloseable, DataInput · All Known Implementing Classes: ObjectInputStream · public interface ObjectInput extends DataInput, AutoCloseable · ObjectInput extends the DataInput interface to include the reading of objects.
Classpath
developer.classpath.org › doc › java › io › ObjectInputStream-source.html
Source for java.io.ObjectInputStream (GNU Classpath 0.95 Documentation)
1: /* ObjectInputStream.java -- Class used to read serialized objects 2: Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 3: Free Software Foundation, Inc. 4: 5: This file is part of GNU Classpath. 6: 7: GNU Classpath is free software; you can redistribute it and/or modify 8: it under the terms of the GNU General Public License as published by 9: the Free Software Foundation; either version 2, or (at your option) 10: any later version. 11...
CodeJava
codejava.net › java-se › file-io › java-io-objectinputstream-and-objectoutputstream-examples
Java IO ObjectInputStream and ObjectOutputStream Examples
July 28, 2019 - We will write two programs for writing and reading objects of this class using the ObjectInputStream and ObjectOutputStream classes. The following StudentRecordWriter program uses the ObjectOutputStream class to write a list of Students object to a file on disk: import java.util.*; import java.text.*; import java.io.*; /** * StudentRecordWriter.java * This program illustrates how to use the ObjectOutputStream class for writing * a list of objects to a file.
Scientech Easy
scientecheasy.com › home › blog › objectinputstream in java
ObjectInputStream in Java - Scientech Easy
February 11, 2025 - The object streams are constructed using ObjectInputStream and ObjectOutputStream classes. In this case, we declare data fields as objects and use ObjectInputStream and ObjectOutputStream classes to read and write these objects from files. This process is called object serialization in Java.
Javaspecialists
javaspecialists.eu › archive › Issue304-ObjectInputFilter.html
[JavaSpecialists 304] - ObjectInputFilter
October 31, 2022 - Java Object Serialization is rare nowadays, and thus we only give it a cursory glance in our "Mastering Java 11 Course". However, there are some fun features and I'd like to expand on them in this newsletter. Prior to Java 9, there was no way of stopping input from an ObjectInputStream.
Openjdk
hg.openjdk.org › jdk8 › jdk8 › jdk › file › 687fd7c7986d › src › share › classes › java › io › ObjectInputStream.java
jdk8/jdk8/jdk: 687fd7c7986d src/share/classes/java/io/ObjectInputStream.java
March 4, 2014 - * 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 specific class. * * <p>For example to read from a stream as written by the example in * ObjectOutputStream: * <br> * <pre> * FileInputStream fis = new FileInputStream("t.tmp"); * ObjectInputStream ois = new ObjectInputStream(fis); * * int i = ois.readInt(); * String today = (String) ois.readObject(); * Date date = (Date) ois.readObject(); * * ois.close(); * </pre> * * <p>Classes control how they are serialized by implementing either the * java.io.Serializable or java.io.Externalizable interfaces.
Programiz
programiz.com › java-programming › objectinputstream
Java ObjectInputStream (With Examples)
The ObjectInputStream is mainly used to read data written by the ObjectOutputStream. Basically, the ObjectOutputStream converts Java objects into corresponding streams. This is known as serialization.
Coding Shuttle
codingshuttle.com › home › handbooks › java programming handbook › objectinputstream and objectoutputstream
ObjectInputStream and ObjectOutputStream | Coding Shuttle
April 9, 2025 - import java.io.*; class Student implements Serializable { int id; String name; public Student(int id, String name) { this.id = id; this.name = name; } } public class ObjectInputExample { public static void main(String[] args) { try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream("student.ser"))) { Student student = (Student) ois.readObject(); System.out.println("ID: " + student.id); System.out.println("Name: " + student.name); } catch (IOException | ClassNotFoundException e) { e.printStackTrace(); } } }
Bureau of Economic Geology
beg.utexas.edu › lmod › agi.servlet › doc › detail › java › io › ObjectInputStream.html
java.io Class ObjectInputStream
Read an object from the ObjectInputStream. The class of the object, the signature of the class, and the values of the non-transient and non-static fields of the class and all of its supertypes are read. Default deserializing for a class can be overriden using the writeObject and readObject methods.
Tutorialspoint
tutorialspoint.com › java › io › java_io_objectinputstream.htm
Java - ObjectInputStream Class
This example writes an object to a file, reads it using ObjectInputStream, and then closes the stream. package com.tutorialspoint; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; class Person implements Serializable { private static final long serialVersionUID = 1L; String name; int age; public Person(String name, int age) { this.name = name; this.age = age; } @Override public String toString() { return "Person{name='" + name + "', age=" + age + "}"; }
Stack Overflow
stackoverflow.com › questions › 13188691 › objectinputstreamjava
ObjectInputStream[Java] - Stack Overflow
public static class Person implements Serializable { private String name; public Person(String name) { super(); this.name = name; } public String getName() { return name; } @Override public String toString() { return name; } } public static class PersonDao { public void write(Person person, File file) throws IOException { ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream(file)); oos.writeObject(person); oos.close(); } public Person read(File file) throws IOException, ClassNotFoundException { ObjectInputStream oos = new ObjectInputStream(new FileInputStream( file)); Person r
Stack Overflow
stackoverflow.com › questions › tagged › objectinputstream
Newest 'objectinputstream' Questions - Stack Overflow
I'm writing a large scale program in java where I keep track of the Nodes with different data structures. Specifically, one of my Node type have 2 left & right pointers for 2 different Binary ... ... public static void updateNumberOfEpsWatched() throws IOException, ClassNotFoundException { String currentDirectory = System.getProperty("user.dir"); ObjectInputStream in =...