0% found this document useful (0 votes)
0 views

scriptobj

The presentation covers Java File Input/Output (I/O) handling, focusing on how to read from and write to files, manage resources, and handle exceptions. Key concepts include streams, classes like FileReader and BufferedWriter, and the importance of File I/O for storing user data and logs. The session concludes with practical examples and a discussion on common I/O exceptions to prepare for potential errors.

Uploaded by

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

scriptobj

The presentation covers Java File Input/Output (I/O) handling, focusing on how to read from and write to files, manage resources, and handle exceptions. Key concepts include streams, classes like FileReader and BufferedWriter, and the importance of File I/O for storing user data and logs. The session concludes with practical examples and a discussion on common I/O exceptions to prepare for potential errors.

Uploaded by

enigma santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Slide 1: Java File Input/Out[ut Handling

Speaker 1:GEOMEL
“Hey everyone! We’re Group 3 — Norylenne, Donna Lyn, Cecille, Jecelle, Melandro,
and Geomel and today we’re digging into a core concept in Java programming: File
Input/Output Handling.
It might sound technical at first, but we’ll go through it together — and by the end,
we’ll all understand how to read from and write to files ”

Slide 2: Learning Objectives


Speaker 2:GEOMEL
“Here’s what we’re aiming to learn today:
 First, how File I/O works in Java ,what it actually means.
 Then, how to use Java classes to read and write files.
 How to manage resources properly, so we don’t leave anything open.
 And finally, how to handle exceptions, so our apps don’t crash when
something goes wrong.”

Slides 3 & 4: Key Terms (Parts 1 & 2)


Speaker 3: GEOMEL
“Let’s go over some terms we’ll keep seeing throughout.
Streams: These are how data moves between your program and a file. There are
two kinds:
 Byte streams — work with binary data (like images or files)
 Character streams — work with text
You’ll also see these classes:
 FileReader and FileWriter: used to read/write character files.
 BufferedReader and BufferedWriter: they make reading and writing faster by
using a buffer kind of like reading a whole page instead of one word at a time.
 IOException: an error that occurs when something goes wrong with input or
output.”
READ OTHER TERMS AND MEANING
“To discuss What is File I/O, I give the floor to mr melandro dela cruz”
Slide 5: What is File I/O?
Speaker 4:MELANDRO
“In Java, File I/O is short for File Input and Output. That means we’re either
reading from a file or writing to it.
It’s how we store data permanently like saving a user’s progress, writing logs, or
storing configuration files.”

Slide 6: Why is File I/O Important?


Speaker 5: MELANDRO
“If we don’t use File I/O, everything our program does disappears when it closes.
With File I/O, we can:
 Store user data
 Create logs
 Export reports
 Load and save settings
Basically, it makes our applications more useful in the real world.”

Slide 7: Common Use Cases


Speaker 6: MELANDRO
“We can use File I/O to:
 Read from files like configuration settings
 Write to files like logs or reports
 Store data like scores, names, or orders
It's not just about storing — it's about interacting with the system and users in a
smarter way.”
“To discuss Streams in Java, I give the floor to ms Jecelle Alvarez”

Slide 8: Streams in Java


Speaker 1:JECELLE
“Streams are how data flows between Java and files.
 InputStream: brings data into your program (like reading from a file)
 OutputStream: sends data out (like writing to a file)
Character streams (Reader/Writer) are great for text. Byte streams
(InputStream/OutputStream) are for binary data like PDFs or images.”

Slides 9–10: FileReader, FileWriter, BufferedReader, BufferedWriter


Speaker 2:JECELLE
“These four classes are key to handling files in Java.
 FileReader and FileWriter are simple and easy to use — great for small jobs.
 BufferedReader and BufferedWriter are faster — they don’t access the disk
every time.
Why buffering helps: Imagine writing one letter at a time versus writing a full
sentence before saving it. Buffers work the same way — improving performance.”
“To discuss KEY FILE I/O CLASSES, I give the floor to MS. NORLYLENNE CUADRA”

Slide 11-12: Key File I/O Classes


Speaker 3:NORYLENNE
“This is a helpful cheat sheet — if you’re not sure what class to use, this gives you
the overview. We mostly work with FileReader, BufferedReader, and their writer
counterparts.
But as you grow, you’ll explore more classes like Scanner, File, FileInputStream,
etc.”

Slide 13-14: Reading Text Files – Example


Speaker 4: READ SLIDE THEN SCRIPT NORYLENNE
“Let’s break this down:
 BufferedReader is used to read the file.
 readLine() reads one line at a time.
 try-with-resources automatically closes the file when we’re done.
 If the file doesn’t exist or there’s an error, we catch it with IOException.
So, this code safely reads a file line by line and prints it.”
Slide 15-16: Reading Entire File Using StringBuilder
READ SLIDE 15 THEN SCRIPT FOR SLIDE 16
Speaker 5:NORYLENNE
“This time, instead of printing line by line, we’re combining everything into a
StringBuilder.
Why? So we can use the full file content later maybe for search, analysis, or
formatting.
It’s fast, clean, and stores the whole file as one big string.”

Slide 17-18: Writing Text Files – Example


READ SLIDE 18 SPEAKER 6
SLIDE 19
Speaker 6: NORYLENNE
This Java code creates a text file named "output_report.txt" and writes the string
"This is the content of the report.\nIt includes important findings and analysis." into
it. It then prints "Content written to output_report.txt" to the console. The code uses
BufferedWriter for efficient writing and a try-with-resources block to ensure the file
is closed properly.
SLIDE 20 READ SLIDE 20 NORYLENNE

“To discuss APPENDING A FILE, I give the floor to MS CECILLE ESPIRITU”

Slide 21: Appending to a File


Speaker 1:READ SLIDE 21 THEN SCRIPT CECILLE
“Here’s a cool trick — adding true to FileWriter lets us append to the file instead of
overwriting.
This is perfect for keeping logs or histories. Every time we run this code, it adds a
new line. This Java code appends the text "Additional information added later."
(preceded by a newline) to an existing file named "output_report.txt". It utilizes
FileWriter in append mode (FileWriter(filePath, true)) and BufferedWriter for efficient
writing, ensuring the file is closed properly using a try-with-resources block. Finally,
it prints a confirmation message to the console.”

Slide 22-24: Try-with-Resources


READ SLIDE 23 AND 24 THEN SCRPT
Speaker 2:CECILLE
“this code is super helpful.
try-with-resources ensures that Java automatically closes the file — even if
something goes wrong.
This prevents memory leaks or file lock issues.”

Slide 25: MULTIPLE RESOURCES


READ SLIDE THEN SCRIPT
Speaker 3:CECILLE
“This example shows how we can open two files at once — one for reading, one
for writing.
It reads from input.txt and writes each line to output.txt.
This is super useful for file conversions or copying content.”

Slide 26-27: I/O Exceptions


READ SLIDE 27 THEN SCRIPT
Speaker 4: CECILLE
“Things can go wrong — files might not exist, paths might be wrong, or the file
might be locked.
Java uses IOException to handle these problems. We’ve seen this in our catch
blocks.
The key is to prepare for failure — and recover gracefully.”
“To discuss COMMON INPUT OUT EXCEPTIONS, I give the floor to DONNA PASCUAL”

Slide 28: Common I/O Exceptions


READ SLIDE THEN SCRIPT
Speaker 5:DONNA
Some exceptions you’ll see often:
 FileNotFoundException: File doesn’t exist.
 EOFException: Reached end of file too early.
 AccessDeniedException: You don’t have permission.
We’ve hit a few of these while testing — so it’s best to understand what they
mean and how to handle them.”
SLIDE 29
READ SLIDE THEN SCRIPT
SPEAKER: DONNA
This Java code reads a text file named "data.txt" line by line and prints each line to
the console. It incorporates robust error handling using try-catch blocks to manage
potential FileNotFoundException (if the file doesn't exist) and general IOException
(for other input/output errors). If an error occurs, it prints an informative error
message and the exception's stack trace to the console. The code leverages
BufferedReader for efficient file reading and try-with-resources to ensure the reader
is automatically closed.

SLIDE 30
SPEAKER DONNA
Imagine you're telling your computer, "Hey, go grab this file for me!" Sometimes,
things go wrong, right? This slide is like a cheat sheet for those "oops" moments.
 (IOException): This is like your computer shrugging and saying, "I tried, but
something's messed up with the file stuff." It could be anything from the file
being gone to your computer not being allowed to touch it.
 " (FileNotFoundException): This is your computer saying, "I looked
everywhere, and I can't find that file you're talking about." Maybe you spelled
the file name wrong, or it's hiding somewhere else.
 (AccessDeniedException): Think of this as your computer being a bouncer at
a club. It's saying, "You don't have the right pass to see that file." You might
need special permission.
 (SecurityException): This is like your computer having a strict rulebook.
Someone (or something) decided your program isn't allowed to mess with
that file, for safety reasons.
Basically, the TABLE is telling you: When your computer has trouble with files, it's
not always the same problem. It could be anything from a simple "file not found" to
a more serious "you're not allowed." Knowing the difference helps you fix things
faster

Slide 31: Conclusion


Speaker 6: DONNA
“To sum it up — Java File I/O lets us interact with the real world. We can save files,
load them, write logs, and so much more.
It’s a skill that makes your apps real and practical not just something that runs and
disappears.”
Closing:
Speaker 1: DONNA
“Thanks for learning with us! We’re still growing our skills, too — but we hope this
gave you a solid foundation. Java File Input/Output is more than just reading and
writing files — it's about giving our programs the ability to communicate with the
outside world.
THAT’S ALL FOR TODAY

You might also like