IO Section Index | Page 3
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
Does the StreamTokenizer close the underlying Reader when it reaches end of stream or do I have to close it manually?
You should close it manually, always.
Short of using JNI, there seems to be no use for them in pure Java programs.
Short of using JNI, you cannot.
File outFile = new File(outPath); BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(outPath)); JarOutputStream jo = new JarOutputStream(bo); String act = f.getPath(); Buff...more
If you know the jar file, you can open it as a java.util.jar.JarFile object and use getJarEntry to retrieve the file in question as a java.util.jar.JarEntry object. After that you can call getT...more
I am trying to add a file to existing zip archive. Using java.util.zip, I am able to add the file. But the only file in the archive is the file I just added. The method putNextEntry in ZipOutputStream class is losing the existing file in the archive.
I am trying to add a file to existing zip archive. Using java.util.zip, I am able to add the file. But the only file in the archive is the file I just added. The method putNextEntry in ZipOutputStr...more
How can I open a file in a way that it prevents other application from reading or writing to the same file?
Use the lock() of the FileChannel class. Prior to Java 1.4, there was no standard way.
Setting a file "hidden" is a system-specific operation and, often, the way to do this is completely different depending upon the platform. In Unix, for example, this can be done by simply renaming...more
I'm afraid you'll have to extract all the contents you want to preserve and create a new zip file, removing the entries you want deleted.
The Image I/O libraries added to Java 1.4 perform this for you: File inputFile = new File(filename); BufferedImage input = ImageIO.read(inputFile); File outputFile = new File(outfilename); ...more
It's got to be a recursive-like method (in that it recurses the subdirs and deletes their contents, too). Something like this will probably work (off the top of my head): import java.io.File; . ...more