IO Section Index | Page 2
Added to JDK 5.0, you can call the defaultCharset() method of the CharSet class, found in the java.nio.charset package. This is apt to depend upon the locale and character set of the underlying sy...more
Typically, you would create a FileOutputStream and pass it to the PrintStream constructor. Starting with 5.0, you can pass the File or String name for file directory to the PrintStream constructor.more
The Appendable interface and its append() methods are implemented in classes that support adding characters to the end of an object, typically a stream. Indirectly used through the Formatter class...more
The java.util.Formatter class was introduced in JDK 5.0 and offers locale-sensitive formatting of numbers and strings.
JDK 5.0 provides built in support for printing tables. Just call the print() method of JTable. Here's an example of such. import javax.swing.*; import java.awt.*; import java.awt.event.*; impor...more
The java.util.Scanner constructor takes a file, channel, input stream, or reader as an argument and lets you read an int (with nextInt()), read a line (with nextLine()), or any other data type wit...more
There are at least three ways to generate formatted output: Use the format() method of an instance of Formatter. Use the format()/printf method of an OutputStream, as in System.out.format("The t...more
The StringBuilder class was introduced with JDK 5.0. Essentially, a StringBuffer is a thread-safe version of StringBuilder. If you are only adding/removing characters from a single-thread, the Str...more
JDK 5.0 added support for code points above U+FFFF. Additional information is available from Supplementary Characters in the Java Platform.more
Until someone provides a PDF print service, you can't. The standard runtime does not provide one. Just because you can specify a DocFlavor of PDF (DocFlavor.STRING.INPUT_STREAM.PDF) doesn't mean y...more
See New I/O Functionality for Java 2 Standard Edition 1.4 and Master Merlin's new I/O classes for examples of using the new capabilities.more
This is a list of some PDF Libraries: PJ free by Ethymon iText free by B.Lowagie &P.Soares retepPDF free by P.T.Mount PDFLib by PDFlib GmbH Faceless PDF library by Faceless.Org Obviously, if...more
How can I correctly parse CSV ( comma separated values ) files? StringTokenizer doesn't seem to fit many conditions.
Ian Darwin has two classes ( CSV.java and CSVRE.java ) to handle CSV files in his Java Cookbook, including a way with regular expressions. You can download the code from his site, probably best t...more
java.util.jar.JarEntry is a subclass of java.util.zip.ZipEntry. If you use the getName() method on your JarEntry object, you will get the full name of the entry, including its path (relative or ab...more
Short of using JNI, you cannot.