Java The Complete Reference, Seventh Edition
} } } This example first reads each character from the stream and prints it as-is, in lowercase. It then resets the stream and b ...
Chapter 19: Input/Output: Exploring java.io 569 When you run the program, you will create the following output. Notice how after ...
570 Part II: The Java Library block, and so on, can have a significant positive impact on performance. This is, however, impleme ...
Chapter 19: Input/Output: Exploring java.io 571 case ' ': if (marked) { marked = false; f.reset(); System.out.print("&"); } ...
Beyond the familiar methods ofInputStream,PushbackInputStreamprovidesunread( ), shown here: void unread(intch) void unread(byteb ...
SequenceInputStream TheSequenceInputStreamclass allows you to concatenate multipleInputStreams. The construction of aSequenceInp ...
574 Part II: The Java Library } input.close(); } } This example creates aVectorand then adds two filenames to it. It passes that ...
Chapter 19: Input/Output: Exploring java.io 575 Recently (with the release of JDK 5), theprintf( )method was added toPrintStream ...
1234567.123, -1234567.123); } } The output is shown here: Here are some numeric values in different formats. Various integer for ...
DataInputStreamis the complement ofDataOuputStream. It extendsFilterInputStream, which extendsInputStream, and it implements the ...
578 Part II: The Java Library RandomAccessFile RandomAccessFileencapsulates a random-access file. It is not derived fromInputStr ...
Chapter 19: Input/Output: Exploring java.io 579 Reader Readeris an abstract class that defines Java’s model of streaming charact ...
580 Part II: The Java Library Method Description abstract void close( ) Closes the input source. Further read attempts will gene ...
Chapter 19: Input/Output: Exploring java.io 581 Creation of aFileWriteris not dependent on the file already existing.FileWriterw ...
582 Part II: The Java Library CharArrayReader CharArrayReaderis an implementation of an input stream that uses a character array ...
Chapter 19: Input/Output: Exploring java.io 583 CharArrayWriter( ) CharArrayWriter(intnumChars) In the first form, a buffer with ...
584 Part II: The Java Library As is the case with the byte-oriented stream, buffering an input character stream also provides th ...
Chapter 19: Input/Output: Exploring java.io 585 default: if (!marked) System.out.print((char) c); break; } } } } BufferedWriter ...
586 Part II: The Java Library char buf[] = new char[s.length()]; s.getChars(0, s.length(), buf, 0); CharArrayReader in = new Cha ...
Chapter 19: Input/Output: Exploring java.io 587 These allow aPrintWriterto be created from aFileobject or by specifying the name ...
«
26
27
28
29
30
31
32
33
34
35
»
Free download pdf