0% found this document useful (0 votes)
4 views10 pages

Java File I/O: Streams and Serialization

Uploaded by

shobanam140
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

Java File I/O: Streams and Serialization

Uploaded by

shobanam140
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Java File I/O and Streams

Introduction
• Read/write data from files
• Supports text and binary data
File Class
• File file = new File("[Link]");
[Link]();
FileReader and FileWriter
• FileWriter writer = new FileWriter("[Link]");
[Link]("Hello"); [Link]();
BufferedReader and
BufferedWriter
• BufferedReader br = new BufferedReader(new
FileReader("[Link]"));
InputStream and OutputStream
• Byte-based streams for binary files
Object Serialization
• ObjectOutputStream out = new
ObjectOutputStream(new
FileOutputStream("[Link]"));
[Link](obj); [Link]();
Scanner Class
• Scanner sc = new Scanner(new File("[Link]"));
Exception Handling in File I/O
• try-with-resources ensures proper closure
Summary
• File I/O allows persistent data storage and
retrieval

You might also like