Topic 10 : Text Files
DDOOCP
COMPLIED BY: ER. PRADIP KHARBUJA
Write to a File
› Explain how a Java program can be used to write to a file.
COMPLIED BY: ER. PRADIP KHARBUJA
Write to a File
COMPLIED BY: ER. PRADIP KHARBUJA
Reading single line from a file
COMPLIED BY: ER. PRADIP KHARBUJA
Reading single line from a file
COMPLIED BY: ER. PRADIP KHARBUJA
Reading whole text from a file
› Outline the steps required in order to read in text from a file on
disk.
› Instead of the...
Renaming a File
COMPLIED BY: ER. PRADIP KHARBUJA
Deleting a file
COMPLIED BY: ER. PRADIP KHARBUJA
File Handling Task
› List all the files from a directory (folder).
› Create a login form. Check the username and password ...
Some Questions & Answers
› Explain what is meant by a ‘stream’ in terms of input/output.
– A stream is a form of I/O in wh...
Some Questions & Answers
› Why we should ensure we use BufferedReaders and BufferedWriters
when constructing our file acce...
Upcoming SlideShare
Loading in …5
×

Topic 10: Text Files

1,508 views

Published on

Slides

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,508
On SlideShare
0
From Embeds
0
Number of Embeds
661
Actions
Shares
0
Downloads
70
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Topic 10: Text Files

  1. 1. Topic 10 : Text Files DDOOCP COMPLIED BY: ER. PRADIP KHARBUJA
  2. 2. Write to a File › Explain how a Java program can be used to write to a file. COMPLIED BY: ER. PRADIP KHARBUJA
  3. 3. Write to a File COMPLIED BY: ER. PRADIP KHARBUJA
  4. 4. Reading single line from a file COMPLIED BY: ER. PRADIP KHARBUJA
  5. 5. Reading single line from a file COMPLIED BY: ER. PRADIP KHARBUJA
  6. 6. Reading whole text from a file › Outline the steps required in order to read in text from a file on disk. › Instead of the following code : › Use following code : COMPLIED BY: ER. PRADIP KHARBUJA
  7. 7. Renaming a File COMPLIED BY: ER. PRADIP KHARBUJA
  8. 8. Deleting a file COMPLIED BY: ER. PRADIP KHARBUJA
  9. 9. File Handling Task › List all the files from a directory (folder). › Create a login form. Check the username and password from text file. › Develop a system to store ncc_id, student_name and batch of a student. Now update your program so that when the save button is clicked the record is appended to a text file on disk and the whole contents of the text file are displayed in tabular format in the output GUI. COMPLIED BY: ER. PRADIP KHARBUJA
  10. 10. Some Questions & Answers › Explain what is meant by a ‘stream’ in terms of input/output. – A stream is a form of I/O in which all data is received in sequence and in one direction. › Explain the phrase ‘buffering’. – Buffering refers to the process of waiting until we have enough read or write operations pending to justify the overhead of file I/O. COMPLIED BY: ER. PRADIP KHARBUJA
  11. 11. Some Questions & Answers › Why we should ensure we use BufferedReaders and BufferedWriters when constructing our file access routines? – We should use BufferedReaders and BufferedWriters because file I/O is usually the performance bottleneck in a program and by reducing the overhead required to make a file operation we can have much more efficient computer programs. COMPLIED BY: ER. PRADIP KHARBUJA

×