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?

Advanced javascript
Advanced javascriptAdvanced javascript
Advanced javascriptDoeun KOCH
 
Collections Framework
Collections FrameworkCollections Framework
Collections FrameworkSunil OS
 
Exception Handling
Exception HandlingException Handling
Exception HandlingSunil OS
 
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 PHPVibrant Technologies & Computers
 
Threads V4
Threads  V4Threads  V4
Threads V4Sunil OS
 
Java Serialization
Java SerializationJava Serialization
Java Serializationjeslie
 
Java Basics V3
Java Basics V3Java Basics V3
Java Basics V3Sunil OS
 
Java 8 - CJ
Java 8 - CJJava 8 - CJ
Java 8 - CJSunil OS
 
JAVA OOP
JAVA OOPJAVA OOP
JAVA OOPSunil OS
 
JDBC
JDBCJDBC
JDBCSunil OS
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernateelliando dias
 
String and string buffer
String and string bufferString and string buffer
String and string bufferkamal kotecha
 
Java 8 streams
Java 8 streamsJava 8 streams
Java 8 streamsManav Prasad
 
Spring Boot
Spring BootSpring Boot
Spring BootJiayun Zhou
 
Hibernate
Hibernate Hibernate
Hibernate Sunil OS
 
Java input
Java inputJava input
Java inputJin Castor
 

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

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
 
Basic of Javaio
Basic of JavaioBasic of Javaio
Basic of Javaiosuraj pandey
 
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
 
Oodp mod4
Oodp mod4Oodp mod4
Oodp mod4cs19club
 
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

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
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
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
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
 
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
 
🐬 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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 

KĂŒrzlich hochgeladen (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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)
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 

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.