Presentation is loading. Please wait.

Presentation is loading. Please wait.

File Input and Output Chapter 14 Java Certification by:Brian Spinnato.

Similar presentations


Presentation on theme: "File Input and Output Chapter 14 Java Certification by:Brian Spinnato."— Presentation transcript:

1 File Input and Output Chapter 14 Java Certification by:Brian Spinnato

2 Text Representation of Character Encoding Java uses two kinds –Unicode for internal representation of characters and strings –UTF for input and output UTF is needed to represent all languages globally –Gives all the bits that a language needs –The compiler has to know which one

3 The File Class See page 374-378 for specific functions Things to note: –Creates and instance of a file, NOT a file on the disk –To be of any use, it should contain a sting that is a name of a file –Path names can be entered ANY way, you must be aware of the OS your on –Constructing / Garbage collecting has no affect on the file system

4 Random Access File Used to access non-standard files, the file that are incompatible with the stream/reader/writer model Allows one to access any part of the file and read and write to it Has two modes during construction –r: read only –rw: read and write

5 Streams, Readers, and Writers The foundation of JAVA IO View input and output as ordered sequences of bytes Can be converted over to primitives, allowing one to “virtually” read in the primitives

6 Low-Level Streams Low-level input streams have methods that read input and return inputs as bytes Low-level output streams have methods that are passed bytes, and write the bytes as output See page 383

7 High-Level Filter Streams Allow the reading and writing of data types High-level input streams do not read from input devices such as files or sockets, they read from other streams High-level output devices do not write to output device, but to other streams See page 385

8 Readers and Writers Like input streams, low level communicate with I/O devices, the high level communicate with low level readers ONLY use Unicode characters, not bytes All extend from Reader super class See page 390


Download ppt "File Input and Output Chapter 14 Java Certification by:Brian Spinnato."

Similar presentations


Ads by Google