900 Files and Streams Chapter 16 A portion
900 Files and Streams Chapter 16 A portion of the class hierarchy of the java.iopackage Writer BufferedWriter CharArrayWriter FilterWriter OutputStreamWriter FileWriter PipedWriter PrintWriter StringWriter Fig. 16.3A portion of the class hierarchy of the java.iopackage (part 2 of 2). 16. InputStream and OutputStream (subclasses of Object) are abstract classes that define methods for performing byte-based input and output, respectively. Programs perform byte-based file input/output with FileInputStream(a subclass of InputStream) and FileOutputStream(a subclass of OutputStream). We use these classes extensively in the examples in this chapter. Pipes are synchronized communication channels between threads or processes. Java provides PipedOutputStream(a subclass of OutputStream) and PipedInput- Stream (a subclass of InputStream) to establish pipes between two threads. One thread sends data to another by writing to a PipedOutputStream. The target thread reads information from the pipe via a PipedInputStream. A PrintStream(a subclass of FilterOutputStream) performs text output to the specified stream. Actually, we have been using PrintStreamoutput throughout the text to this point System.outis a PrintStream, as is System.err. A FilterInputStreamfilters an InputStream, and a FilterOutStreamfilters an OutputStream; filtering simply means that the filter stream provides additional functionality, such as buffering, monitoring line numbers or aggregating data bytes into meaningful primitive-data-type units. FilterInputStream and FilterOutput- Streamare abstractclasses, so additional functionality is provided by their subclasses. Reading data as raw bytes is fast but crude. Usually programs read data as aggregates of bytes that form an int, a float, a doubleand so on. Java programs can use several classes to input and output data in aggregate form. A RandomAccessFileis useful for direct-access applications, such as transaction- processing applications like airline-reservations systems and point-of-sale systems. With a sequential-access file, each successive input/output request reads or writes the next consecutive set of data in the file. With a random-access file, each successive input/output request could be directed to any part of the file perhaps one widely separated from the part of the file referenced in the previous request. Direct-access applications provide rapid access to specific data items in large files; often, such applications are used in applications that require users to wait for answers these answers must be made available quickly, or the people might become impatient and take their business elsewhere.
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.