A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
Java in General
Author
Reg Zip file creation
vijay kumar
Ranch Hand
Joined: Nov 10, 2006
Posts: 62
posted
Feb 21, 2007 04:01:00
0
Hi,
I am having a problem with zip file creation for creationg zip file i have return on method:
public void CreateZipFile(
String
zipFileName, String[] ToCompressFiles)
{
try
{
String[] fileNames = ToCompressFiles;
FileInputStream
inStream;
FileOutputStream
outStream = new
FileOutputStream
(zipFileName);
ZipOutputStream
zipOStream = new
ZipOutputStream
(outStream);
zipOStream.setLevel ( Deflater.BEST_COMPRESSION );
for (int loop=0;loop < fileNames.length; loop++)
{
inStream = new
FileInputStream
(fileNames[loop]);
zipOStream.putNextEntry(new
ZipEntry
(fileNames[loop]));
int i=0;
while ((i=inStream.read())!=-1)
{
zipOStream.write(i);
}
zipOStream.closeEntry();
inStream.close();
}
zipOStream.flush();
zipOStream.close();
}
catch (
IllegalArgumentException
iae)
{
iae.printStackTrace();
}
catch(
FileNotFoundException
fe)
{
System.out.println("File not found===="+fe);
}
catch (
IOException
ioe)
{
System.out.println("IOException===="+ioe);
ioe.printStackTrace();
}
}
but with this iam getting exception message:
File not found====java.io.FileNotFoundException: R:\datacenter\UHC\hcfa-h\data\07023\13421771-hcfa-h (Access is denied)
but manually i am able to create zip file in my server.........
so please help me with this
Regards,
Vijay
I agree. Here's the link:
http://zeroturnaround.com/jrebel/download
subject: Reg Zip file creation
Similar Threads
ZipOutputStream
Problem in creating a zip file java
reg zip file creation
how to zip multiple files and directory into one output
Java --- ZIP & UNZIP
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter