You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Soundararajan Thevaraj (JIRA)" <ji...@apache.org> on 2010/04/17 16:40:25 UTC
[jira] Created: (COMPRESS-105) While Archiving the empty
directories are not archived to the archive.
While Archiving the empty directories are not archived to the archive.
----------------------------------------------------------------------
Key: COMPRESS-105
URL: https://issues.apache.org/jira/browse/COMPRESS-105
Project: Commons Compress
Issue Type: Bug
Environment: 64 bit Windows Vista, JDK1.4.1_11
Reporter: Soundararajan Thevaraj
Fix For: 1.0
I am trying to create a zip archive. I am having a empty directory "test" . When i try to create it to archive . The archive created but the test folder is created as file. And also I got the below exception.
Temp file created at C:\Users\Soundar\AppData\Local\Temp\sample5278197872513888977.zip
Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
at com.tcs.tools.archive.test.ArchiveTest.createArchive(ArchiveTest.java:64)
at com.tcs.tools.archive.test.ArchiveTest.main(ArchiveTest.java:119)
Code used
-------------
protected File createArchive(String archivename) throws Exception {
ArchiveOutputStream out = null;
OutputStream stream = null;
ArchiveStreamFactory factory = new ArchiveStreamFactory();
try {
File archive = File.createTempFile("sample", "." + archivename);
System.out.println("Temp file created at " + archive.getAbsolutePath());
List archiveList = new ArrayList();
stream = new FileOutputStream(archive);
out = factory.createArchiveOutputStream(archivename, stream);
final File file7 = new File("C:\\Users\\Soundar\\Desktop\\test");
addArchiveEntry(out, "test", file7);
System.out.println("Going to process directory");
System.out.println("Directory Name =" + file7.getName());
ArchiveEntry entry = out.createArchiveEntry(file7, "test");
out.putArchiveEntry(entry);
IOUtils.copy(new FileInputStream(file7), out);
out.closeArchiveEntry();
out.finish();
return archive;
} finally {
if (out != null) {
out.close();
} else if (stream != null) {
stream.close();
}
}
}
Note
------
I tried the same archiving using the compressed zip of Windows Vista default feature. It creates the Sample.zip which contains the empty test folder as archived.
I know there is a work around using java.util.zip.zipEntry. But is there a work around in our Compress itself?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Resolved: (COMPRESS-105) While Archiving the empty
directories are not archived to the archive.
Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stefan Bodewig resolved COMPRESS-105.
-------------------------------------
Fix Version/s: 1.1
Resolution: Fixed
this is between "not a problem" and "fixed via better documentation"
> While Archiving the empty directories are not archived to the archive.
> ----------------------------------------------------------------------
>
> Key: COMPRESS-105
> URL: https://issues.apache.org/jira/browse/COMPRESS-105
> Project: Commons Compress
> Issue Type: Bug
> Affects Versions: 1.0
> Environment: 64 bit Windows Vista, JDK1.4.1_11
> Reporter: Soundararajan Thevaraj
> Fix For: 1.1
>
> Attachments: ArchiveIssue.JPG, TestDirectory.java
>
>
> I am trying to create a zip archive. I am having a empty directory "test" . When i try to create it to archive . The archive created but the test folder is created as file. And also I got the below exception.
> Temp file created at C:\Users\Soundar\AppData\Local\Temp\sample5278197872513888977.zip
> Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
> at com.tcs.tools.archive.test.ArchiveTest.createArchive(ArchiveTest.java:64)
> at com.tcs.tools.archive.test.ArchiveTest.main(ArchiveTest.java:119)
> Code used
> -------------
> protected File createArchive(String archivename) throws Exception {
> ArchiveOutputStream out = null;
> OutputStream stream = null;
> ArchiveStreamFactory factory = new ArchiveStreamFactory();
> try {
> File archive = File.createTempFile("sample", "." + archivename);
> System.out.println("Temp file created at " + archive.getAbsolutePath());
> List archiveList = new ArrayList();
> stream = new FileOutputStream(archive);
> out = factory.createArchiveOutputStream(archivename, stream);
> final File file7 = new File("C:\\Users\\Soundar\\Desktop\\test");
> addArchiveEntry(out, "test", file7);
> System.out.println("Going to process directory");
> System.out.println("Directory Name =" + file7.getName());
> ArchiveEntry entry = out.createArchiveEntry(file7, "test");
> out.putArchiveEntry(entry);
> IOUtils.copy(new FileInputStream(file7), out);
> out.closeArchiveEntry();
> out.finish();
> return archive;
> } finally {
> if (out != null) {
> out.close();
> } else if (stream != null) {
> stream.close();
> }
> }
> }
> Note
> ------
> I tried the same archiving using the compressed zip of Windows Vista default feature. It creates the Sample.zip which contains the empty test folder as archived.
> I know there is a work around using java.util.zip.zipEntry. But is there a work around in our Compress itself?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-105) While Archiving the empty
directories are not archived to the archive.
Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858442#action_12858442 ]
Stefan Bodewig commented on COMPRESS-105:
-----------------------------------------
We don't see your addArchiveEntry method, but I suspect I know what the problem is.
It isn't properly document and I'll change that soonish: the name of an ZipArchiveEntry determines whether an entry is considered a directory or not. If you don't use the constructor with the File argument the entry's name must end in a "/" in order for the entry to be known as a directory.
> While Archiving the empty directories are not archived to the archive.
> ----------------------------------------------------------------------
>
> Key: COMPRESS-105
> URL: https://issues.apache.org/jira/browse/COMPRESS-105
> Project: Commons Compress
> Issue Type: Bug
> Environment: 64 bit Windows Vista, JDK1.4.1_11
> Reporter: Soundararajan Thevaraj
> Fix For: 1.0
>
>
> I am trying to create a zip archive. I am having a empty directory "test" . When i try to create it to archive . The archive created but the test folder is created as file. And also I got the below exception.
> Temp file created at C:\Users\Soundar\AppData\Local\Temp\sample5278197872513888977.zip
> Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
> at com.tcs.tools.archive.test.ArchiveTest.createArchive(ArchiveTest.java:64)
> at com.tcs.tools.archive.test.ArchiveTest.main(ArchiveTest.java:119)
> Code used
> -------------
> protected File createArchive(String archivename) throws Exception {
> ArchiveOutputStream out = null;
> OutputStream stream = null;
> ArchiveStreamFactory factory = new ArchiveStreamFactory();
> try {
> File archive = File.createTempFile("sample", "." + archivename);
> System.out.println("Temp file created at " + archive.getAbsolutePath());
> List archiveList = new ArrayList();
> stream = new FileOutputStream(archive);
> out = factory.createArchiveOutputStream(archivename, stream);
> final File file7 = new File("C:\\Users\\Soundar\\Desktop\\test");
> addArchiveEntry(out, "test", file7);
> System.out.println("Going to process directory");
> System.out.println("Directory Name =" + file7.getName());
> ArchiveEntry entry = out.createArchiveEntry(file7, "test");
> out.putArchiveEntry(entry);
> IOUtils.copy(new FileInputStream(file7), out);
> out.closeArchiveEntry();
> out.finish();
> return archive;
> } finally {
> if (out != null) {
> out.close();
> } else if (stream != null) {
> stream.close();
> }
> }
> }
> Note
> ------
> I tried the same archiving using the compressed zip of Windows Vista default feature. It creates the Sample.zip which contains the empty test folder as archived.
> I know there is a work around using java.util.zip.zipEntry. But is there a work around in our Compress itself?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-105) While Archiving the empty
directories are not archived to the archive.
Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858489#action_12858489 ]
Stefan Bodewig commented on COMPRESS-105:
-----------------------------------------
I'm having a hard time converting your source file from RTF to a real source file. ;-)
Does the problem go away if you remove the IOUtils.copy() line from addArchiveEntry?
I think the exception you see stemming from close() in your finally block is actualy hiding a different exception thrown in addArchiveEntry.
> While Archiving the empty directories are not archived to the archive.
> ----------------------------------------------------------------------
>
> Key: COMPRESS-105
> URL: https://issues.apache.org/jira/browse/COMPRESS-105
> Project: Commons Compress
> Issue Type: Bug
> Environment: 64 bit Windows Vista, JDK1.4.1_11
> Reporter: Soundararajan Thevaraj
> Fix For: 1.0
>
> Attachments: ArchiveIssue.JPG, TestDirectory.java
>
>
> I am trying to create a zip archive. I am having a empty directory "test" . When i try to create it to archive . The archive created but the test folder is created as file. And also I got the below exception.
> Temp file created at C:\Users\Soundar\AppData\Local\Temp\sample5278197872513888977.zip
> Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
> at com.tcs.tools.archive.test.ArchiveTest.createArchive(ArchiveTest.java:64)
> at com.tcs.tools.archive.test.ArchiveTest.main(ArchiveTest.java:119)
> Code used
> -------------
> protected File createArchive(String archivename) throws Exception {
> ArchiveOutputStream out = null;
> OutputStream stream = null;
> ArchiveStreamFactory factory = new ArchiveStreamFactory();
> try {
> File archive = File.createTempFile("sample", "." + archivename);
> System.out.println("Temp file created at " + archive.getAbsolutePath());
> List archiveList = new ArrayList();
> stream = new FileOutputStream(archive);
> out = factory.createArchiveOutputStream(archivename, stream);
> final File file7 = new File("C:\\Users\\Soundar\\Desktop\\test");
> addArchiveEntry(out, "test", file7);
> System.out.println("Going to process directory");
> System.out.println("Directory Name =" + file7.getName());
> ArchiveEntry entry = out.createArchiveEntry(file7, "test");
> out.putArchiveEntry(entry);
> IOUtils.copy(new FileInputStream(file7), out);
> out.closeArchiveEntry();
> out.finish();
> return archive;
> } finally {
> if (out != null) {
> out.close();
> } else if (stream != null) {
> stream.close();
> }
> }
> }
> Note
> ------
> I tried the same archiving using the compressed zip of Windows Vista default feature. It creates the Sample.zip which contains the empty test folder as archived.
> I know there is a work around using java.util.zip.zipEntry. But is there a work around in our Compress itself?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COMPRESS-105) While Archiving the empty
directories are not archived to the archive.
Posted by "Soundararajan Thevaraj (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Soundararajan Thevaraj updated COMPRESS-105:
--------------------------------------------
Attachment: ArchiveIssue.JPG
For your reference . I have attached screen shot of the archive created using Compressed Zip of Windows XP.
> While Archiving the empty directories are not archived to the archive.
> ----------------------------------------------------------------------
>
> Key: COMPRESS-105
> URL: https://issues.apache.org/jira/browse/COMPRESS-105
> Project: Commons Compress
> Issue Type: Bug
> Environment: 64 bit Windows Vista, JDK1.4.1_11
> Reporter: Soundararajan Thevaraj
> Fix For: 1.0
>
> Attachments: ArchiveIssue.JPG, TestDirectory.java
>
>
> I am trying to create a zip archive. I am having a empty directory "test" . When i try to create it to archive . The archive created but the test folder is created as file. And also I got the below exception.
> Temp file created at C:\Users\Soundar\AppData\Local\Temp\sample5278197872513888977.zip
> Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
> at com.tcs.tools.archive.test.ArchiveTest.createArchive(ArchiveTest.java:64)
> at com.tcs.tools.archive.test.ArchiveTest.main(ArchiveTest.java:119)
> Code used
> -------------
> protected File createArchive(String archivename) throws Exception {
> ArchiveOutputStream out = null;
> OutputStream stream = null;
> ArchiveStreamFactory factory = new ArchiveStreamFactory();
> try {
> File archive = File.createTempFile("sample", "." + archivename);
> System.out.println("Temp file created at " + archive.getAbsolutePath());
> List archiveList = new ArrayList();
> stream = new FileOutputStream(archive);
> out = factory.createArchiveOutputStream(archivename, stream);
> final File file7 = new File("C:\\Users\\Soundar\\Desktop\\test");
> addArchiveEntry(out, "test", file7);
> System.out.println("Going to process directory");
> System.out.println("Directory Name =" + file7.getName());
> ArchiveEntry entry = out.createArchiveEntry(file7, "test");
> out.putArchiveEntry(entry);
> IOUtils.copy(new FileInputStream(file7), out);
> out.closeArchiveEntry();
> out.finish();
> return archive;
> } finally {
> if (out != null) {
> out.close();
> } else if (stream != null) {
> stream.close();
> }
> }
> }
> Note
> ------
> I tried the same archiving using the compressed zip of Windows Vista default feature. It creates the Sample.zip which contains the empty test folder as archived.
> I know there is a work around using java.util.zip.zipEntry. But is there a work around in our Compress itself?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COMPRESS-105) While Archiving the empty
directories are not archived to the archive.
Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stefan Bodewig updated COMPRESS-105:
------------------------------------
Fix Version/s: (was: 1.0)
Affects Version/s: 1.0
> While Archiving the empty directories are not archived to the archive.
> ----------------------------------------------------------------------
>
> Key: COMPRESS-105
> URL: https://issues.apache.org/jira/browse/COMPRESS-105
> Project: Commons Compress
> Issue Type: Bug
> Affects Versions: 1.0
> Environment: 64 bit Windows Vista, JDK1.4.1_11
> Reporter: Soundararajan Thevaraj
> Fix For: 1.1
>
> Attachments: ArchiveIssue.JPG, TestDirectory.java
>
>
> I am trying to create a zip archive. I am having a empty directory "test" . When i try to create it to archive . The archive created but the test folder is created as file. And also I got the below exception.
> Temp file created at C:\Users\Soundar\AppData\Local\Temp\sample5278197872513888977.zip
> Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
> at com.tcs.tools.archive.test.ArchiveTest.createArchive(ArchiveTest.java:64)
> at com.tcs.tools.archive.test.ArchiveTest.main(ArchiveTest.java:119)
> Code used
> -------------
> protected File createArchive(String archivename) throws Exception {
> ArchiveOutputStream out = null;
> OutputStream stream = null;
> ArchiveStreamFactory factory = new ArchiveStreamFactory();
> try {
> File archive = File.createTempFile("sample", "." + archivename);
> System.out.println("Temp file created at " + archive.getAbsolutePath());
> List archiveList = new ArrayList();
> stream = new FileOutputStream(archive);
> out = factory.createArchiveOutputStream(archivename, stream);
> final File file7 = new File("C:\\Users\\Soundar\\Desktop\\test");
> addArchiveEntry(out, "test", file7);
> System.out.println("Going to process directory");
> System.out.println("Directory Name =" + file7.getName());
> ArchiveEntry entry = out.createArchiveEntry(file7, "test");
> out.putArchiveEntry(entry);
> IOUtils.copy(new FileInputStream(file7), out);
> out.closeArchiveEntry();
> out.finish();
> return archive;
> } finally {
> if (out != null) {
> out.close();
> } else if (stream != null) {
> stream.close();
> }
> }
> }
> Note
> ------
> I tried the same archiving using the compressed zip of Windows Vista default feature. It creates the Sample.zip which contains the empty test folder as archived.
> I know there is a work around using java.util.zip.zipEntry. But is there a work around in our Compress itself?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COMPRESS-105) While Archiving the empty
directories are not archived to the archive.
Posted by "Soundararajan Thevaraj (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858571#action_12858571 ]
Soundararajan Thevaraj commented on COMPRESS-105:
-------------------------------------------------
Hi Stefan,
My sincere apologize for the file corruption. !!!Hurray!!!!. After removing IOUtils.copy it worked. I can able to generate the Zip archive containing test/emptyfolder. Great help. Bunch of thanks to you.
> While Archiving the empty directories are not archived to the archive.
> ----------------------------------------------------------------------
>
> Key: COMPRESS-105
> URL: https://issues.apache.org/jira/browse/COMPRESS-105
> Project: Commons Compress
> Issue Type: Bug
> Environment: 64 bit Windows Vista, JDK1.4.1_11
> Reporter: Soundararajan Thevaraj
> Fix For: 1.0
>
> Attachments: ArchiveIssue.JPG, TestDirectory.java
>
>
> I am trying to create a zip archive. I am having a empty directory "test" . When i try to create it to archive . The archive created but the test folder is created as file. And also I got the below exception.
> Temp file created at C:\Users\Soundar\AppData\Local\Temp\sample5278197872513888977.zip
> Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
> at com.tcs.tools.archive.test.ArchiveTest.createArchive(ArchiveTest.java:64)
> at com.tcs.tools.archive.test.ArchiveTest.main(ArchiveTest.java:119)
> Code used
> -------------
> protected File createArchive(String archivename) throws Exception {
> ArchiveOutputStream out = null;
> OutputStream stream = null;
> ArchiveStreamFactory factory = new ArchiveStreamFactory();
> try {
> File archive = File.createTempFile("sample", "." + archivename);
> System.out.println("Temp file created at " + archive.getAbsolutePath());
> List archiveList = new ArrayList();
> stream = new FileOutputStream(archive);
> out = factory.createArchiveOutputStream(archivename, stream);
> final File file7 = new File("C:\\Users\\Soundar\\Desktop\\test");
> addArchiveEntry(out, "test", file7);
> System.out.println("Going to process directory");
> System.out.println("Directory Name =" + file7.getName());
> ArchiveEntry entry = out.createArchiveEntry(file7, "test");
> out.putArchiveEntry(entry);
> IOUtils.copy(new FileInputStream(file7), out);
> out.closeArchiveEntry();
> out.finish();
> return archive;
> } finally {
> if (out != null) {
> out.close();
> } else if (stream != null) {
> stream.close();
> }
> }
> }
> Note
> ------
> I tried the same archiving using the compressed zip of Windows Vista default feature. It creates the Sample.zip which contains the empty test folder as archived.
> I know there is a work around using java.util.zip.zipEntry. But is there a work around in our Compress itself?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COMPRESS-105) While Archiving the empty
directories are not archived to the archive.
Posted by "Soundararajan Thevaraj (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Soundararajan Thevaraj updated COMPRESS-105:
--------------------------------------------
Attachment: TestDirectory.java
Hi Stefan,
Thanks for your comments. But i tried by adding the "/" at the end of the entry name. It was not working. I have attached the java file for your reference. Kindly review that.
I am trying to archive a folder "test" which contains the child folder called "empty folder" with zero entries.
But Getting the same exception as below
File Created in PathC:\DOCUME~1\157558\LOCALS~1\Temp\sample738293534710494610.zip
FileName =test/
Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
at TestDirectory.createArchive(TestDirectory.java:49)
at TestDirectory.main(TestDirectory.java:66)
> While Archiving the empty directories are not archived to the archive.
> ----------------------------------------------------------------------
>
> Key: COMPRESS-105
> URL: https://issues.apache.org/jira/browse/COMPRESS-105
> Project: Commons Compress
> Issue Type: Bug
> Environment: 64 bit Windows Vista, JDK1.4.1_11
> Reporter: Soundararajan Thevaraj
> Fix For: 1.0
>
> Attachments: TestDirectory.java
>
>
> I am trying to create a zip archive. I am having a empty directory "test" . When i try to create it to archive . The archive created but the test folder is created as file. And also I got the below exception.
> Temp file created at C:\Users\Soundar\AppData\Local\Temp\sample5278197872513888977.zip
> Exception in thread "main" java.io.IOException: This archives contains unclosed entries.
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:343)
> at org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:550)
> at com.tcs.tools.archive.test.ArchiveTest.createArchive(ArchiveTest.java:64)
> at com.tcs.tools.archive.test.ArchiveTest.main(ArchiveTest.java:119)
> Code used
> -------------
> protected File createArchive(String archivename) throws Exception {
> ArchiveOutputStream out = null;
> OutputStream stream = null;
> ArchiveStreamFactory factory = new ArchiveStreamFactory();
> try {
> File archive = File.createTempFile("sample", "." + archivename);
> System.out.println("Temp file created at " + archive.getAbsolutePath());
> List archiveList = new ArrayList();
> stream = new FileOutputStream(archive);
> out = factory.createArchiveOutputStream(archivename, stream);
> final File file7 = new File("C:\\Users\\Soundar\\Desktop\\test");
> addArchiveEntry(out, "test", file7);
> System.out.println("Going to process directory");
> System.out.println("Directory Name =" + file7.getName());
> ArchiveEntry entry = out.createArchiveEntry(file7, "test");
> out.putArchiveEntry(entry);
> IOUtils.copy(new FileInputStream(file7), out);
> out.closeArchiveEntry();
> out.finish();
> return archive;
> } finally {
> if (out != null) {
> out.close();
> } else if (stream != null) {
> stream.close();
> }
> }
> }
> Note
> ------
> I tried the same archiving using the compressed zip of Windows Vista default feature. It creates the Sample.zip which contains the empty test folder as archived.
> I know there is a work around using java.util.zip.zipEntry. But is there a work around in our Compress itself?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.