ch16 - Java Programming Fourth Edition Chapter 16 File...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
Java Programming Fourth Edition Chapter 16 File Input and Output
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Programming, Fourth Edition 2 Objectives • Understand computer files • Use the File class • Understand data file organization and streams • Use streams • Write to and read from a file
Background image of page 2
Java Programming, Fourth Edition 3 Objectives (continued) • Write formatted file data • Read formatted file data • Use a variable filename • Create and use random access files • Write records to a random access file
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Programming, Fourth Edition 4 Objectives (continued) • Read records from a random access file • Read and write objects to and from files
Background image of page 4
Java Programming, Fourth Edition 5 Understanding Computer Files • Temporary storage – Computer memory or random access memory (RAM) – Volatile • Permanent storage – Not lost when computer loses power – Nonvolatile • Computer file – Collection of information stored on nonvolatile device in computer system
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Programming, Fourth Edition 6 Understanding Computer Files (continued) • Permanent storage devices – Hard disks – Floppy disks – Zip disks – USB drives – Reels or cassettes of magnetic tape – Compact discs • Data files – Contain facts and figures
Background image of page 6
Java Programming, Fourth Edition 7 Understanding Computer Files (continued) • Program files or application files – Store software instructions • Root directory • Folders or directories • Path – Complete list of disk drive plus hierarchy of directories in which file resides
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Programming, Fourth Edition 8 Understanding Computer Files (continued) • Work with stored files in application – Determine whether and where file exists – Open file – Read data from file – Write information to file – Close file
Background image of page 8
Java Programming, Fourth Edition 9 Using the File Class • File class – Gather file information – java.io package File someData = new File("Data.txt"); File someData = new File("C:\\Java\ \Chapter.16\\Data.txt");
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Programming, Fourth Edition 10 Selected File Class Methods
Background image of page 10
Java Programming, Fourth Edition 11 The FileDemo Class
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Programming, Fourth Edition 12 Understanding Data File Organization and Streams • Retain data for any significant amount of time – Save on permanent, secondary storage device • Businesses store data in hierarchy – Character – Field – Record – Files • Sequential access file – Each record stored in order based on value in some field
Background image of page 12
Java Programming, Fourth Edition 13 Data Hierarchy
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Programming, Fourth Edition 14 Understanding Data File Organization and Streams (continued) • Open file – Create object – Associate stream of bytes with it • Close file
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2011 for the course 332 351 taught by Professor Staff during the Fall '08 term at Rutgers.

Page1 / 45

ch16 - Java Programming Fourth Edition Chapter 16 File...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online