1 / 21

Description

Description

eyal
Download Presentation

Description

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Description • The java.io package contains classes that can be used to create different types of streams that have different types of functionality. In SDKl.4, the java.nio package contains classes and other packages that provide fast buffered I/O, character set conversions, new I/O exception classes, and overall improved I/O performance. • To get the functionality you need for a stream, you often need to combine, or layer, two or more streams. When you layer two or more streams, you create a filtered stream. • To make disk processing more efficient, you can use a buffered stream by adding a block of internal memory called a buffer to the stream. Then, output data is stored in the buffer before it is written to a file, and input data is read into the buffer before it is processed by a program. • When an output buffer is full, the program flushes the buffer, which means that it sends the data in the buffer to the I/O device. When an input buffer is full, the program stops reading data from the I/O device into the buffer. • Buffers significantly improve the performance of disk operations because they reduce the number of device operations.

  2. Description • Most exceptions that are thrown by classes that perform I/O operations inherit the IOException class. • For efficiency, its best to prevent some exceptions from every occurring instead of catching them with catch blocks. That's why the code above prevent the EOF and FileNotFound exceptions from occurring.

  3. Description • To identify the name and location of a file, you can use an absolute pathname to specify the entire path profile, or you can use a relative pathname to specify the path of the file relative to another directory. • When coding path and filenames, the forward slash works in both Windows and Unix system while the backslash only works on Windows systems. In addition, to code a backslash as a String literal, you must use the escape sequence (\\), which makes your code more difficult to understand. • To create a File object that represents a file on a remote computer, you can use the Universal Naming Convention (UNC). To do that, code two forward slashes (//) followed by the hostname and the share name.

More Related