|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Thereversemethod contains some other interesting code; in particular, these two statements:The code opens aBufferedReader in = new BufferedReader(source); ... PrintWriter out = new PrintWriter(pipeOut);BufferedReaderonsource, which is another reader of a different type. This essentially "wraps"sourcein aBufferedReader. The program reads from theBufferedReader, which in turn reads fromsource. The program does this so that it can useBufferedReader's convenientreadLinemethod. Similarly, thePipedWriteris wrapped in aPrintWriterso that the program can usePrintWriter's convenientprintlnmethod. You will often see streams wrapped in this way so as to combine the various features of the many streams.
|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2004 Sun Microsystems, Inc. All rights reserved.