SlideShare uma empresa Scribd logo
1 de 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.

Mais conteúdo relacionado

Mais procurados

What is Serialization in Java? | Java Tutorial | Edureka
What is Serialization in Java? | Java Tutorial | EdurekaWhat is Serialization in Java? | Java Tutorial | Edureka
What is Serialization in Java? | Java Tutorial | EdurekaEdureka!
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVAAnkita Totala
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streamsShahjahan Samoon
 
Data types in python
Data types in pythonData types in python
Data types in pythonRaginiJain21
 
Method Overloading In Java
Method Overloading In JavaMethod Overloading In Java
Method Overloading In JavaCharthaGaglani
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsAnton Keks
 
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYAPYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYAMaulik Borsaniya
 
L11 array list
L11 array listL11 array list
L11 array listteach4uin
 
Abstract class in c++
Abstract class in c++Abstract class in c++
Abstract class in c++Sujan Mia
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methodsShubham Dwivedi
 
Serialization & De-serialization in Java
Serialization & De-serialization in JavaSerialization & De-serialization in Java
Serialization & De-serialization in JavaInnovationM
 

Mais procurados (20)

Java String
Java StringJava String
Java String
 
Packages in java
Packages in javaPackages in java
Packages in java
 
What is Serialization in Java? | Java Tutorial | Edureka
What is Serialization in Java? | Java Tutorial | EdurekaWhat is Serialization in Java? | Java Tutorial | Edureka
What is Serialization in Java? | Java Tutorial | Edureka
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
 
Java String class
Java String classJava String class
Java String class
 
2D Array
2D Array 2D Array
2D Array
 
Java string handling
Java string handlingJava string handling
Java string handling
 
Generics
GenericsGenerics
Generics
 
Java Strings
Java StringsJava Strings
Java Strings
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Method Overloading In Java
Method Overloading In JavaMethod Overloading In Java
Method Overloading In Java
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and Streams
 
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYAPYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
 
L11 array list
L11 array listL11 array list
L11 array list
 
Abstract class in c++
Abstract class in c++Abstract class in c++
Abstract class in c++
 
String in java
String in javaString in java
String in java
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Serialization & De-serialization in Java
Serialization & De-serialization in JavaSerialization & De-serialization in Java
Serialization & De-serialization in Java
 

Destaque (7)

Java Serialization
Java SerializationJava Serialization
Java Serialization
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
 
5java Io
5java Io5java Io
5java Io
 
Generic Programming
Generic ProgrammingGeneric Programming
Generic Programming
 
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
 

Semelhante a 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
 

Semelhante a 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?
 

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
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
 
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
 
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
 
[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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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?
 
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...
 
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
 
[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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

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.