SlideShare a Scribd company logo
8
Most read
9
Most read
16
Most read
JAVA I/O
KIRAN V KULKARNI
ROLL NO: 28 DIV: A
MCA IV SEMESTER
NAVNEET PRAKASH
ROLL NO: 40 DIV: A
MCA IV SEMESTER
 It is an abstraction that either produces or consumes
information.
 Stream is linked to a physical device by the Java I/O system.
 A stream is a sequence of data.
 Stream is composed of bytes.
 It's called a stream because it's like a stream of water that
continues to flow.
 Java implements streams within class hierarchies
defined in the java.io package.
 Input and Output (I/O) is used to process the input and
produce the output based on the input.
 Java uses the concept of stream to make I/O operations
fast.
 java.io package contains all the classes required for
input and output operations.
Java I/O and Object Serialization
 Byte streams are defined by using two class hierarchies.
1. Inputstream
2. Outputstream
 Provides convenient means for handling input and
output of bytes.
System Class Meaning
 Character streams are defined by using two class
hierarchies.
1. Reader
2. Writer
 Character streams provide a convenient means for
handling input and output of characters.
Object Serialization
 Serializing objects is the process of writing objects to a file.
 When an object is serialized, its state and other attributes are
converted into an ordered series of bytes.
 This byte series can be written into streams.
How to serialize Objects in Java
 Any object whose class implements the java.io.Serializable interface can
be made persistent
import java.io.*;
public class UserData implements Serializable
{
-----member data------
-----member methods-----
}
Classes used for Reading and writing objects
 The ObjectInputStream class
 The ObjectOutputStream class
The Classes are found
in
java.io package
ObjectOutputStream
Methods
 public void writeObject(Object obj)
 Write the specified object to the ObjectOutputStream.
 public void WriteUTF(String str)
 Primitive data write of this String in UTF format.
 public void flush()
 Flushes the stream
 public void close()
 Closes the stream
Java I/O and Object Serialization
Java I/O and Object Serialization
Java I/O and Object Serialization
Java I/O and Object Serialization
Introduction to Transient variables
 You use the transient keyword to indicate to the Java virtual machine
that the indicated variable is not part of the persistent state of the
object.
 Variables that are part of the persistent state of an object must be
saved when the object is archived
class MyData implements Serializable
{String name;
transient int age;
---constructor to enterdata
}
Summary (Contd.)
• Serialization allows reducing time taken to write code for
save and restoration of object or application state
• Serialization makes it easier for objects to travel over a
network connection.
• Transient Variables are not persisted.

More Related Content

PPTX
Java package
PPT
Class and object in C++
PPTX
Event handling
PPTX
JAVA AWT
PPT
1.python interpreter and interactive mode
PPTX
Binary Tree in Data Structure
PPTX
Binary Tree Traversal
PPTX
File in C language
Java package
Class and object in C++
Event handling
JAVA AWT
1.python interpreter and interactive mode
Binary Tree in Data Structure
Binary Tree Traversal
File in C language

What's hot (20)

PPTX
Values and Data types in python
PPTX
Asymptotic notations
PPTX
Advance Java Programming(CM5I) Event handling
PPTX
Java swing
PPTX
07. Virtual Functions
PPTX
Access specifiers(modifiers) in java
PPT
Abstract class in java
PPT
Installing Python 2.7 in Windows
PDF
Java Linked List Tutorial | Edureka
PPTX
classes and objects in C++
PPTX
Pointers in C Programming
PDF
Function overloading ppt
PPTX
PPT
Quick sort data structures
PPTX
Quick sort-Data Structure
PDF
File and directories in python
ODP
Python Modules
PPTX
Java Strings
PPSX
Data Types & Variables in JAVA
Values and Data types in python
Asymptotic notations
Advance Java Programming(CM5I) Event handling
Java swing
07. Virtual Functions
Access specifiers(modifiers) in java
Abstract class in java
Installing Python 2.7 in Windows
Java Linked List Tutorial | Edureka
classes and objects in C++
Pointers in C Programming
Function overloading ppt
Quick sort data structures
Quick sort-Data Structure
File and directories in python
Python Modules
Java Strings
Data Types & Variables in JAVA
Ad

Viewers also liked (8)

PPT
Java Serialization
PDF
Java Serialization
PDF
5java Io
PPTX
Generic Programming
PPTX
Understanding java streams
PPS
Jdbc architecture and driver types ppt
PPSX
JDBC: java DataBase connectivity
Java Serialization
Java Serialization
5java Io
Generic Programming
Understanding java streams
Jdbc architecture and driver types ppt
JDBC: java DataBase connectivity
Ad

Similar to Java I/O and Object Serialization (20)

PPT
IO and serialization
PPT
Md121 streams
PDF
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
PPTX
Gulshan serialization inJava PPT ex.pptx
PPTX
CHAPTER 5 mechanical engineeringasaaa.pptx
PPTX
File Handling - Serialization.pptx
PDF
IO Streams, Serialization, de-serialization, autoboxing
PPTX
Files io
PPSX
Java IO, Serialization
PPTX
Session 22 - Java IO, Serialization
PDF
inputoutputstreams-140612032817-phpapp02.pdf
PPT
Input output streams
PPTX
Java Input Output (java.io.*)
PPT
Jedi Slides Intro2 Chapter12 Advanced Io Streams
PDF
Programming language JAVA Input output opearations
PPTX
Input & output
PDF
Java IO
PDF
Java IO Stream, the introduction to Streams
PPT
Various io stream classes .47
PPT
Various io stream classes .47
IO and serialization
Md121 streams
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
Gulshan serialization inJava PPT ex.pptx
CHAPTER 5 mechanical engineeringasaaa.pptx
File Handling - Serialization.pptx
IO Streams, Serialization, de-serialization, autoboxing
Files io
Java IO, Serialization
Session 22 - Java IO, Serialization
inputoutputstreams-140612032817-phpapp02.pdf
Input output streams
Java Input Output (java.io.*)
Jedi Slides Intro2 Chapter12 Advanced Io Streams
Programming language JAVA Input output opearations
Input & output
Java IO
Java IO Stream, the introduction to Streams
Various io stream classes .47
Various io stream classes .47

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Cloud computing and distributed systems.
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Electronic commerce courselecture one. Pdf
Encapsulation theory and applications.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
Dropbox Q2 2025 Financial Results & Investor Presentation
20250228 LYD VKU AI Blended-Learning.pptx
Spectral efficient network and resource selection model in 5G networks
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Monthly Chronicles - July 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Network Security Unit 5.pdf for BCA BBA.
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
Electronic commerce courselecture one. Pdf

Java I/O and Object Serialization

  • 1. JAVA I/O KIRAN V KULKARNI ROLL NO: 28 DIV: A MCA IV SEMESTER NAVNEET PRAKASH ROLL NO: 40 DIV: A MCA IV SEMESTER
  • 2.  It is an abstraction that either produces or consumes information.  Stream is linked to a physical device by the Java I/O system.  A stream is a sequence of data.  Stream is composed of bytes.  It's called a stream because it's like a stream of water that continues to flow.
  • 3.  Java implements streams within class hierarchies defined in the java.io package.  Input and Output (I/O) is used to process the input and produce the output based on the input.  Java uses the concept of stream to make I/O operations fast.  java.io package contains all the classes required for input and output operations.
  • 5.  Byte streams are defined by using two class hierarchies. 1. Inputstream 2. Outputstream  Provides convenient means for handling input and output of bytes.
  • 7.  Character streams are defined by using two class hierarchies. 1. Reader 2. Writer  Character streams provide a convenient means for handling input and output of characters.
  • 8. Object Serialization  Serializing objects is the process of writing objects to a file.  When an object is serialized, its state and other attributes are converted into an ordered series of bytes.  This byte series can be written into streams.
  • 9. How to serialize Objects in Java  Any object whose class implements the java.io.Serializable interface can be made persistent import java.io.*; public class UserData implements Serializable { -----member data------ -----member methods----- }
  • 10. Classes used for Reading and writing objects  The ObjectInputStream class  The ObjectOutputStream class The Classes are found in java.io package
  • 11. ObjectOutputStream Methods  public void writeObject(Object obj)  Write the specified object to the ObjectOutputStream.  public void WriteUTF(String str)  Primitive data write of this String in UTF format.  public void flush()  Flushes the stream  public void close()  Closes the stream
  • 16. Introduction to Transient variables  You use the transient keyword to indicate to the Java virtual machine that the indicated variable is not part of the persistent state of the object.  Variables that are part of the persistent state of an object must be saved when the object is archived class MyData implements Serializable {String name; transient int age; ---constructor to enterdata }
  • 17. Summary (Contd.) • Serialization allows reducing time taken to write code for save and restoration of object or application state • Serialization makes it easier for objects to travel over a network connection. • Transient Variables are not persisted.