PrintWriter class enables you to write formatted data to an underlying
For instance, writing
long and other primtive data formatted as text, rather
than as their byte values.
Here is a simple example:
PrintWriter writer = new PrintWriter(writer); writer.print(true); writer.print((int) 123); writer.print((float) 123.456); writer.printf(Locale.UK, "Text + data: %1$", 123); writer.close();
PrintWriter class contains the powerful
methods (they do exactly the same, but the name "printf" is more familiar to C-programmers). These methods
allow you to mix text and data in very advanced ways, using a formatting string.
For more information about
printf() see the JavaDoc.
PrintWriter has a wide selection of contructors that enable you to connect it to
OutputStream, or a