SlideShare ist ein Scribd-Unternehmen logo
1 von 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.

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Advanced javascript
Advanced javascriptAdvanced javascript
Advanced javascript
 
Collections Framework
Collections FrameworkCollections Framework
Collections Framework
 
Java I/O
Java I/OJava I/O
Java I/O
 
Java IO
Java IOJava IO
Java IO
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
 
Threads V4
Threads  V4Threads  V4
Threads V4
 
Java Serialization
Java SerializationJava Serialization
Java Serialization
 
Java Basics V3
Java Basics V3Java Basics V3
Java Basics V3
 
Java Streams
Java StreamsJava Streams
Java Streams
 
Java 8 - CJ
Java 8 - CJJava 8 - CJ
Java 8 - CJ
 
JAVA OOP
JAVA OOPJAVA OOP
JAVA OOP
 
JDBC
JDBCJDBC
JDBC
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
String and string buffer
String and string bufferString and string buffer
String and string buffer
 
Java 8 streams
Java 8 streamsJava 8 streams
Java 8 streams
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Oop concepts in python
Oop concepts in pythonOop concepts in python
Oop concepts in python
 
Hibernate
Hibernate Hibernate
Hibernate
 
Java input
Java inputJava input
Java input
 

Andere mochten auch (6)

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
 

Ähnlich wie 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
 

Ähnlich wie 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?
 

Kürzlich hochgeladen

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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
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
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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
 
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
 

Kürzlich hochgeladen (20)

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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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?
 

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.