dcsimg
Extracting dll and exe from a resource zip file
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, August 21, 2002 06:53 AM

This one is slightly convoluted:-) I have a jar file which in turn has a zip file. On the client I need to unzip the zip file on the client folder. Here's the code I'm using. private void unzipFileToDirectory(String fileName, String dirPath) throws Exception{ ZipEntry anEntry = null; ZipInputStream inputStream = new ZipInputStream(getClass().getResourceAsStream(fileName)); anEntry = inputStream.getNextEntry(); while (anEntry != null) { System.out.println("Extracting file: " + anEntry.getName()); long decompressedSize = anEntry.getSize(); byte[] uncompressedBuf = new byte[(int)decompressedSize]; inputStream.read(uncompressedBuf); FileOutputStr   More>>

This one is slightly convoluted:-)

I have a jar file which in turn has a zip file. On the client I need to unzip the zip file on the client folder. Here's the code I'm using.

			
private void unzipFileToDirectory(String fileName, String dirPath) throws Exception{
ZipEntry anEntry = null;
ZipInputStream inputStream = new ZipInputStream(getClass().getResourceAsStream(fileName));
anEntry = inputStream.getNextEntry();
while (anEntry != null)
{
System.out.println("Extracting file: " + anEntry.getName());
long decompressedSize = anEntry.getSize();
byte[] uncompressedBuf = new byte[(int)decompressedSize];
inputStream.read(uncompressedBuf);
FileOutputStream bo = new FileOutputStream(dirPath + anEntry.getName());
bo.write(uncompressedBuf);
anEntry = inputStream.getNextEntry();

}
inputStream.close();

}


it seems to create a directory and unzips the file but when I see the files they are not complete i know that because one of the html files i can see is not complete the rest are dlls on unzip they show different size than original files. Any thoughts?    <<Less

Re: Extracting dll and exe from a resource zip file

Posted By:   Christopher_Koenigsberg  
Posted On:   Wednesday, August 21, 2002 10:25 AM

Are the copies OK, in the zip file itself?

About | Sitemap | Contact