I have an application written in Java that uses a jar file(it uses more than one, but that's not the point).
The fact is, the Jar file I'm using contains files that I absolutely MUST extract to the filesystem.
So far I'm using Class.getResourceAsStream and FileOutputStream, but this method is somewhat slow. Note that some of these files are text-based, but others are simply binary.
So apart from trying to reduce the need to extract files from JARs, are there any optimizations(such as more adequated functions) for these tasks.
Note that my application is Java 6-based and I would like to reduce external dependencies to a minimum.
EDIT: For future reference, my OLD(inefficent) code was:
int c;
while((c = is.read())!=-1){
fos.write(c);
}
For the new, much faster code, see the accepted reply.