SlideShare une entreprise Scribd logo
1  sur  17
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.
 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
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.

Contenu connexe

Tendances (20)

Java I/O
Java I/OJava I/O
Java I/O
 
Wrapper class
Wrapper classWrapper class
Wrapper class
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
 
Java constructors
Java constructorsJava constructors
Java constructors
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
L21 io streams
L21 io streamsL21 io streams
L21 io streams
 
Hibernate in Action
Hibernate in ActionHibernate in Action
Hibernate in Action
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
Java Annotations
Java AnnotationsJava Annotations
Java Annotations
 
Input output files in java
Input output files in javaInput output files in java
Input output files in java
 
Serialization in java
Serialization in javaSerialization in java
Serialization in java
 
Java Input Output and File Handling
Java Input Output and File HandlingJava Input Output and File Handling
Java Input Output and File Handling
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Generics
GenericsGenerics
Generics
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
 

En vedette (7)

Java Serialization
Java SerializationJava Serialization
Java Serialization
 
5java Io
5java Io5java Io
5java Io
 
Generic Programming
Generic ProgrammingGeneric Programming
Generic Programming
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Jdbc Ppt
Jdbc PptJdbc Ppt
Jdbc Ppt
 

Similaire à Java I/O and Object Serialization

IO and serialization
IO and serializationIO and serialization
IO and serializationbackdoor
 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scannerArif Ullah
 
Unit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptxUnit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptxDrYogeshDeshmukh1
 
Java programming Chapter 4.pptx
Java programming Chapter 4.pptxJava programming Chapter 4.pptx
Java programming Chapter 4.pptxssusera0d3d2
 
Computer science input and output BASICS.pptx
Computer science input and output BASICS.pptxComputer science input and output BASICS.pptx
Computer science input and output BASICS.pptxRathanMB
 
Java - File Input Output Concepts
Java - File Input Output ConceptsJava - File Input Output Concepts
Java - File Input Output ConceptsVicter Paul
 
Qb it1301
Qb   it1301Qb   it1301
Qb it1301ArthyR3
 
Java OOP Concepts 1st Slide
Java OOP Concepts 1st SlideJava OOP Concepts 1st Slide
Java OOP Concepts 1st Slidesunny khan
 
Writing Usable APIs in Practice by Giovanni Asproni
Writing Usable APIs in Practice by Giovanni AsproniWriting Usable APIs in Practice by Giovanni Asproni
Writing Usable APIs in Practice by Giovanni AsproniSyncConf
 
File handling in input and output
File handling in input and outputFile handling in input and output
File handling in input and outputpradeepa velmurugan
 
1.26 File Input-Output in JAVA.pptx
1.26 File Input-Output in JAVA.pptx1.26 File Input-Output in JAVA.pptx
1.26 File Input-Output in JAVA.pptxYashrajMohrir
 
What is java input and output stream?
What is java input and output stream?What is java input and output stream?
What is java input and output stream?kanchanmahajan23
 

Similaire à Java I/O and Object Serialization (20)

IO and serialization
IO and serializationIO and serialization
IO and serialization
 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scanner
 
Unit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptxUnit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptx
 
Java programming Chapter 4.pptx
Java programming Chapter 4.pptxJava programming Chapter 4.pptx
Java programming Chapter 4.pptx
 
Java quickref
Java quickrefJava quickref
Java quickref
 
1_JavIntro
1_JavIntro1_JavIntro
1_JavIntro
 
Basic of Javaio
Basic of JavaioBasic of Javaio
Basic of Javaio
 
Unit IV Notes.docx
Unit IV Notes.docxUnit IV Notes.docx
Unit IV Notes.docx
 
Java Wrapper Classes and I/O Mechanisms
Java Wrapper Classes and I/O MechanismsJava Wrapper Classes and I/O Mechanisms
Java Wrapper Classes and I/O Mechanisms
 
Computer science input and output BASICS.pptx
Computer science input and output BASICS.pptxComputer science input and output BASICS.pptx
Computer science input and output BASICS.pptx
 
Java - File Input Output Concepts
Java - File Input Output ConceptsJava - File Input Output Concepts
Java - File Input Output Concepts
 
Qb it1301
Qb   it1301Qb   it1301
Qb it1301
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Java OOP Concepts 1st Slide
Java OOP Concepts 1st SlideJava OOP Concepts 1st Slide
Java OOP Concepts 1st Slide
 
Writing Usable APIs in Practice by Giovanni Asproni
Writing Usable APIs in Practice by Giovanni AsproniWriting Usable APIs in Practice by Giovanni Asproni
Writing Usable APIs in Practice by Giovanni Asproni
 
Java quick reference v2
Java quick reference v2Java quick reference v2
Java quick reference v2
 
Oodp mod4
Oodp mod4Oodp mod4
Oodp mod4
 
File handling in input and output
File handling in input and outputFile handling in input and output
File handling in input and output
 
1.26 File Input-Output in JAVA.pptx
1.26 File Input-Output in JAVA.pptx1.26 File Input-Output in JAVA.pptx
1.26 File Input-Output in JAVA.pptx
 
What is java input and output stream?
What is java input and output stream?What is java input and output stream?
What is java input and output stream?
 

Dernier

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

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.
  • 4.
  • 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
  • 12.
  • 13.
  • 14.
  • 15.
  • 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.