public class PrintStream extends FilterOutputStream
A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently. Two other features are provided as well. Unlike other output streams, a PrintStream never throws an IOException; instead, exceptional situations merely set an internal flag that can be tested via the checkError method. Optionally, a PrintStream can be created so as to flush automatically; this means that the flush method is automatically invoked after a byte array is written, one of the println methods is invoked, or a newline character or byte ('\n') is written.
All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. The PrintWriter class should be used in situations that require writing characters rather than bytes.
public class PrintWriter extends Writer
Print formatted representations of objects to a text-output stream. This class implements all of the print methods found in PrintStream. It does not contain methods for writing raw bytes, for which a program should use unencoded byte streams.
Unlike the PrintStream class, if automatic flushing is enabled it will be done only when one of the println() methods is invoked, rather than whenever a newline character happens to be output. The println() methods use the platform's own notion of line separator rather than the newline character.
Methods in this class never throw I/O exceptions. The client may inquire as to whether any errors have occurred by invoking checkError().
Tell us what exactly you don't understand....We will appreciate your kind efforts regarding this issue......
But first of all come up with exact problem ... [ September 12, 2006: Message edited by: Ankur Sharma ]
The Best way to predict your future is to create it - Every great individual common man
PrintStream is an older class, from before Writer was defined. PrintStream is an OutputStream, which means it is mainly intended for processing bytes. PrintWriter is a Writer, meaning it is intended for processing characters. As the "printing" operations that both classes perform are more to do with characters, PrintWriter is usually preferred over PrintStream.
If what you want to do is to do "printing" operations and the ultimate destination is an OutputStream, use an OutputStreamWriter between your PrintWriter and your OutputStream.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database