Problem in unzipping a file : ZipInputStream

Hi All,
I am having some issues in unzipping a zip file using ZipInputStream.
Following is the code :
public class ZipInputStreamExample {
      * @param args
     public static void main(String[] args) {
          // TODO Auto-generated method stub
          final int BUFFER = 2048;
          try {
               ZipInputStream zip = new ZipInputStream(new BufferedInputStream(
                         new FileInputStream(
                                   "OBU4526 - Change to mobile services pages-1.zip")));
               ZipEntry entry;
               System.out.println("hello world");
               while ((entry = zip.getNextEntry()) != null) {
                    System.out.println("Unzipping: " + entry);
                    int count;
                    byte[] data = new byte[BUFFER];
                    FileOutputStream fout = new FileOutputStream(entry.getName());
                    BufferedOutputStream buf = new BufferedOutputStream(fout,
                              data.length);
                    while ((count = zip.read(data, 0, BUFFER)) != -1) {
                         buf.write(data, 0, count);
                    buf.flush();
                    buf.close();
               zip.close();
          } catch (FileNotFoundException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
          } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
}Following is the exception which I am getting :
hello world
Unzipping: OBU4526 - Change to mobile services pages/css/
java.io.FileNotFoundException: OBU4526 - Change to mobile services pages\css (The system cannot find the path specified)
     at java.io.FileOutputStream.open(Native Method)
     at java.io.FileOutputStream.<init>(Unknown Source)
     at java.io.FileOutputStream.<init>(Unknown Source)
     at com.example.io.ZipInputStreamExample.main(ZipInputStreamExample.java:37)Any problem with the code ? How could I solve this issue ? Do I need to create the directory structure (OBU4526 - Change to mobile services pages\css) ? Shouldn't the FileOutputStream create the structure if it isn't created. ?
Any help would be appreciated.
Thanks
Siddharth

ejp wrote:
Delete that directory and try again.I did that and tried again. I refreshed and noticed that what is happening is that top level folder is being created but after that sub folders are not being created. It is not recognizing sub folders under the top level folders. Under the top level folder its directly making the file instead of making the folder. Following is the code snippet:
while ((entry = zip.getNextEntry()) != null) {
                    System.out.println("Unzipping: " + entry);
                    int count;
                    new File(entry.getName()).getParentFile().mkdirs();
                    bos = new BufferedOutputStream(new FileOutputStream(entry.getName()));
                    while((count = zip.read(b, 0, BUFFER)) != -1){
                         bos.write(b, 0, count);
               zip.closeEntry();
               }Its also giving the following exception :
Unzipping: OBU4526 - Change to mobile services pages/css/
Unzipping: OBU4526 - Change to mobile services pages/css/discover-activate.css
java.io.FileNotFoundException: OBU4526 - Change to mobile services pages\css\discover-activate.css (The system cannot find the path specified)
     at java.io.FileOutputStream.open(Native Method)
     at java.io.FileOutputStream.<init>(Unknown Source)
     at java.io.FileOutputStream.<init>(Unknown Source)
     at com.example.io.ZipInputStreamExample.main(ZipInputStreamExample.java:41)It has created the folder "OBU4526 - Change to mobile services pages" but not "css". Instead of creating the folder css its creating the file css. Instead it should create the folder "css" also and then create the file "discover-activate.css". I don't know why its giving this exception. :(
By this exception I suppose its asking us to create the css folder also. I am correct.
What's the resolution of this issue.?
Please do help me in resolving this issue. Thanks in advance.

Similar Messages

  • Problem in unzip a file

    hai,
    Iam trying to unzip a file but its not working.
    //Unzip a file
      final int BUFFER = 2048;
      String zfname=application.getRealPath("/") + "temp/Bulk.zip"; 
           File  zf=new File(zfname);
      try {
             BufferedOutputStream dest = null;
             FileInputStream fis = new FileInputStream(zf);
             ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
             ZipEntry entry;
             while((entry = zis.getNextEntry()) != null)
                                       System.out.println("Extracting: " +entry);
                     int count;
                     byte data[] = new byte[BUFFER];
                    // write the files to the disk
                    File outFile=new File(outPath);
                    //FileOutputStream fos = new FileOutputStream(outFile);
                    FileOutputStream fos = new FileOutputStream(entry.getName());
                    dest = new BufferedOutputStream(fos, BUFFER);
                    while ((count = zis.read(data, 0, BUFFER))!= -1)
                        dest.write(data, 0, count);
                    dest.flush();
                    dest.close();
             zis.close();
          } catch(Exception e) {
             e.printStackTrace();
    Bulk.zip folder has the following files:
    Bulk/test.txt
    Bulk/fm.jsp
    I get the following exception
    java.io.FileNotFoundException: Bulk\test.txt
    (The system cannot find the path specified)
    Iam i making mistake in this line
    FileOutputStream fos = new FileOutputStream(entry.getName());
                    dest = new BufferedOutputStream(fos, BUFFER);Thanks,
    Thanuja.

    ok vijay iam so sorry for not mentioning how i rectified it. somehow i missed it. may be was bit excited when i got the result.
    anyways below code worked.
    //Unzip a file
        String zip_fname=request.getParameter("zfilename")!=null?request.getParameter("zfilename"):"";
        String fromZip=zip_fname;
        //out.println("FromZip:"+fromZip);
        File zipFname=new File(newFileName);
        String toLocation=newFilePath; //path to unzip the file
        String seperator = System.getProperty("file.separator");
        System.out.println("unzipping zip file to "+toLocation);
        try
            BufferedOutputStream dest = null;
            File zipDir = new File(toLocation);
             zipDir.mkdir();
            ZipFile zip = new ZipFile(fromZip);
            final int BUFFER = 2048;
            FileInputStream fin=new FileInputStream(fromZip);
            ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fin));
            ZipEntry entry;
            while((entry = zis.getNextEntry()) != null)
                     //System.out.println("Extracting: " +entry);
                     int count;
                     byte data[] = new byte[BUFFER];
                     String zip_Fname=entry.getName().substring(entry.getName().lastIndexOf("/")+1);
                        if(!zip_Fname.equals(""))
                            zipFiles.add(zip_Fname);
                  if(!zip_Fname.equals(""))  
                     FileOutputStream fos = new FileOutputStream(toLocation + seperator + entry.getName().substring(entry.getName().lastIndexOf("/")+1));
                     dest = new BufferedOutputStream(fos, BUFFER);
                     while ((count = zis.read(data, 0, BUFFER))!= -1)
                        dest.write(data, 0, count);
                    dest.flush();
                    dest.close();
             zis.close();
        catch (Exception ex)
            unZipResult++;
            System.out.println(ex);
        }Thanks,
    Thanuja.

  • Unable to unzip this file

    hello
    i have a problem with unzipping a file with multiple directories inside.
    here are my main problems :
    - When there is an accent in the directory name (ex: "répertoire" / in french) the letter with accent is replaced by a comma ("r,pertoire").
    - The test for directory .isDirectory() doesn't works : it recognizes the directory as an entry which leads to exception.
    i've tried four different codes and none worked.
    you can find the file i want to extract here : http://www.mediafire.com/download.php?gunazmnfzga
    thanks

    just found nice code http://rox.javaeye.com/blog/434813
    with teaking it a little bit, i got it working perfectly :
    String TempDirectory = "C:\\WINDOWS\\TEMP\\";
    private void unzip5(String filename) throws IOException
             File f = new File(filename);
             org.apache.commons.compress.archivers.zip.ZipFile zf = new
                     org.apache.commons.compress.archivers.zip.ZipFile(f, "IBM437");
    File folder = new File(TempDirectory + f.getName()+"\\");
             if (!folder.exists())   folder.mkdirs();
              for (Enumeration<ZipArchiveEntry> files = zf.getEntries(); files.hasMoreElements();)
                  ZipArchiveEntry zae = files.nextElement();
                  String zipname = zae.getName();
                  ZipArchiveEntry packinfo = zf.getEntry(zipname);
                  File chemin = new File(folder+"\\"+zipname);
                  if (packinfo.isDirectory())
                      chemin.mkdirs();
                  else
                      if (!chemin.getParentFile().exists())
                          chemin.getParentFile().mkdirs();
                      String fn = folder + File.separator + zipname;
                      FileOutputStream fos = new FileOutputStream(fn);
                      InputStream is = zf.getInputStream(packinfo);
                      IOUtils.copy(is, fos);
                      is.close();
                      fos.flush();
                      fos.close();
        }big thanks to all ppl who helped!

  • Problem in deleting Zip files unzipped using java.util.zip

    I have a static methos for unzipping a zip file. after unzipping the file when i am trying to delete that file using File.delete()its not getting deleted. but when methods like exist(). canRead(), canWrite() methods are returning true what can be the possible problem ? i had closed all the streams after unzipping operation Please go through the following code.
    public static boolean unzipZipFile(String dir_name, String zipFileName) {
    try {
    ZipFile zip = new ZipFile(zipFileName);
    Enumeration entries = zip.entries();
    while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry) entries.nextElement();
    // got all the zip entries here
    // now has to process all the files
    // first all directories
    // then all the files
    if (entry.isDirectory()) {
    // now the directories are created
    File buf=new File(dir_name,entry.getName());
    buf.mkdirs();
    continue;
    }// now got the dirs so process the files
    entries = zip.entries();
    while(entries.hasMoreElements()) {
    // now to process the files
    ZipEntry entry = (ZipEntry) entries.nextElement();
    if (!entry.isDirectory()){
    File buf=new File(dir_name,entry.getName());
    copyInputStream(
    zip.getInputStream(entry),
    new BufferedOutputStream(
    new FileOutputStream(buf)));}
    } catch (IOException e) {
    e.printStackTrace();
    return false;
    return true;
    now i am trying to call this method to unzip a zip file
    public static void main (String arg[]){
    unzipZipFile("C:/temp","C:/tmp.zip");
    java.io.File filer = new File("C:/tmp.zip");
    System.out.println (filer.canRead());
    System.out.println (filer.canWrite());
    System.out.println (filer.delete());
    Please tell me where my program is going wrong ?

    Thanks .. the problem is solved... i was not closing the Zip file .. rather i was trying to close all the other streams that i used for IO operaion ... thanks a lot

  • ZipInputStream & ZipEntry taking time to unzip big file

    Hi,
    We have big zip file around 2GB which needs to downloaded and unzipped. We are using ZipInputStream & ZipEntry for unzipping the files.
    This is taking around 45 min to unzip the file. Do we have better alternative for doing the same?
    Thanks in advance
    Regards,
    Ravi

    Below is the code we are using:
    public void getZipFiles(String sSourcePath, String sDestPath)
            try
                sDestPath = sDestPath + Util.getFileSeparator();
                byte[] buf = new byte[1024];
                ZipInputStream zipinputstream = null;
                ZipEntry zipentry;
                BufferedOutputStream  outBuffer =null;
                BufferedInputStream inBuffer = null;
                zipinputstream = new ZipInputStream(
                    new FileInputStream(sSourcePath));
                String sFile =sSourcePath.substring(0,  sSourcePath.indexOf("."));
            File f = new File(sFile);
            if(f.mkdir())
                System.out.println( f + " Directory Created");
            else
            System.out.println(f + " Directory is not created");
                zipentry = zipinputstream.getNextEntry();
                while (zipentry != null)
                    //for each entry to be extracted
                    String entryName = zipentry.getName();
                    int n;
                    if(zipentry.isDirectory())
                        File f1 = new File(sDestPath+zipentry.getName());
                         if(f1.mkdir())
                                System.out.println(f + " Directory Created");
                            else
                            System.out.println(f + " Directory is not created");
                    else
                    FileOutputStream fileoutputstream;
                    File newFile = new File(entryName);
                    String directory = newFile.getParent();
                    if(directory == null)
                        if(newFile.isDirectory())
                            break;
                    fileoutputstream = new FileOutputStream(sDestPath+entryName);
                    outBuffer = new BufferedOutputStream(fileoutputstream);
                    inBuffer = new BufferedInputStream(zipinputstream);
                   /* while ((n = zipinputstream.read(buf, 0, 1024)) > -1)
                        fileoutputstream.write(buf, 0, n);*/
                    while(true){
                       int bytedata = inBuffer.read();
                      if(bytedata == -1)       break;
                      outBuffer.write(bytedata);
                    outBuffer.flush();
                    fileoutputstream.close();
                    fileoutputstream.flush();
                   // zipinputstream.closeEntry();
                    zipentry = zipinputstream.getNextEntry();
                }//while
                zipinputstream.close();
                outBuffer.close();
                inBuffer.close();
            catch (Exception e)
                e.printStackTrace();
        }Edited by: EJP on 5/02/2013 22:07: code tags

  • Problem with unzipping file

    I am trying to unzip a file using java.util.zip. It is throwing a ZipException in the first line where I instantiate ZipFile object.
    ZipFile oFile = new ZipFile("/myzip.zip");java.util.jar is not working either. It fails right here:
    JarFile oFile = new JarFile("/myzip.zip");Here is the exception thrown in the above cases:
    java.util.zip.ZipException: error in opening zip file
            at java.util.zip.ZipFile.open(Native Method)
            at java.util.zip.ZipFile.<init>(Unknown Source)
            at java.util.jar.JarFile.<init>(Unknown Source)
            at java.util.jar.JarFile.<init>(Unknown Source)
            at ReadZipFile.main(ReadZipFile.java:21)
    An interesting observation:
    I am able to extract the contents of the zip from the command-line using jar utility.
    jar xvf myzip.zipI am stumped! I think jar utility internally uses the same classes for unzipping files. How come it is working with jar utility whereas it is not working from Java program? Also, the myzip.zip appears to be a valid archive - I am able to open it with winzip.
    Any pointers will be appreciated.
    Thanks in advance,
    Ganesh

    I think the above reply is correct but didn't explain why you would be getting a file not found. Unless you have your zip file at the root of your harddrive the slash in the filename is improper. Without the slash your code will assume your current working directory and look for the file there.
    By putting that forward slash in there you are telling the code to look at the root of the filestructure and NOT at the current working directory.

  • Problem using payloadZipBean to unzip a file

    I would like to run OS command to zip large amount of xml into one zip file before XI pick it up, then use unzip option in payloadZipBean to unzip all the xml files so XI can process them one by one from memory, this will reduce lots file I/O time.
    But I am getting this warning message:
    Warning Zip: message is empty or has no payload
    But if I display this message in RWB, the only payload is this zip file.
    Why the payloadZipBean is not unzipping this file as supposed to.

    Did you check this blog
    /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
    Sameer

  • Problem with unzip file install817ntee.zip

    When I unzip the file install817ntee.zip downloaded from oracle.com with WINRAR, it is say "it is unpredictable at the end of file"; So do when I unzip the file "OWB_902560.zip'

    When I unzip the file install817ntee.zip downloaded from oracle.com with WINRAR, it is say "it is unpredictable at the end of file"; So do when I unzip the file "OWB_902560.zip'

  • Unzip a file preserving the folder structure

    Hi guys,
    I have create a zip file using java.util.zip and I preserv all directory structure. When I unzip the file using the same library, in the loop of ZipEntry I don't find never a directory. This the code that I use and don't work:
    public void dataDecompression(String pathArchivio) {
        try {
            fileInputStream = new FileInputStream(pathArchivio);
           checkedInputStream = new CheckedInputStream(fileInputStream, new Adler32());
           zipInputStream = new ZipInputStream(new BufferedInputStream(checkedInputStream));
           ZipEntry entry;
           while((entry = zipInputStream.getNextEntry()) != null){
                if(entry.isDirectory()){
                     //make dir          
               else{
                    //write file
    }Maybe I miss something in compression? Excuse for my bad english.
    Thanks in advance.

    three problems with that.
    1) you don't recusively create folders.
    2) you create a folder with the name of the file you want to write.
    3) you don't create files.
    File file=new File(entry.getName());
    if(file.getParentFile()!=null);
         file.getParentFile().mkdirs();
    if( !entry.isDirectory() ) {
    //code that write file;

  • Problen in unzip a file in folder structure

    hi,
    how can i unzip a file and folder with folder structure. when i unzip a file it create problem. please help to solve this problem.
    here is my code
    import java.io.*;
    import java.util.zip.*;
    public class MakeUnzip {
    final static int BUFFER = 2048;
    public static void main (String argv[]) {
    try {
    BufferedOutputStream dest = null;
    FileInputStream fis = new FileInputStream("D:/serverdata/dates.zip");
    // String root = "D:/clientdata/";
    ZipInputStream zis = new
    ZipInputStream(new BufferedInputStream(fis));
    ZipEntry entry;
    ZipFile zipfile = new ZipFile("D:/serverdata/dates.zip");
    while((entry = zis.getNextEntry()) != null) {
    int count;
    byte data[] = new byte[BUFFER];
    if(entry.isDirectory()){
         File dir = new File(entry.getName());
         if(!dir.exists()){          dir.mkdir();                 }      
    FileOutputStream fos =null;
    fos = new FileOutputStream(entry.getName());
    dest = new BufferedOutputStream(fos, BUFFER);
    while ((count = zis.read(data, 0, BUFFER))
    != -1) {
    dest.write(data, 0, count);
    dest.flush();
    dest.close();
    zis.close();
    } catch(Exception e) {
    e.printStackTrace();
    Please give me solution.
    Thanks in advance

    try this one and change it as u like:
    import java.util.zip.ZipFile;
    import java.util.zip.ZipEntry;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.io.File;
    public class UnzipFile {
    private static void doUnzipFiles(String zipFileName) {
    try {
    ZipFile zf = new ZipFile(zipFileName);
    System.out.println("Archive: " + zipFileName);
    // Enumerate each entry
    for (Enumeration entries = zf.entries(); entries.hasMoreElements();) {
    // Get the entry and its name
    ZipEntry zipEntry = (ZipEntry)entries.nextElement();
    if (zipEntry.isDirectory())
    boolean success = (new File(zipEntry.getName())).mkdir();
    else
    String zipEntryName = zipEntry.getName();
    System.out.println(" inflating: " + zipEntryName);
    OutputStream out = new FileOutputStream(zipEntryName);
    InputStream in = zf.getInputStream(zipEntry);
    byte[] buf = new byte[1024];
    int len;
    while((len = in.read(buf)) > 0) {
    out.write(buf, 0, len);
    // Close streams
    out.close();
    in.close();
    } catch (IOException e) {
    e.printStackTrace();
    System.exit(1);
    public static void main(String[] args) {
    if (args.length != 1) {
    System.err.println("Usage: java UnzipFile zipfilename");
    } else {
    doUnzipFiles(args[0]);
    }

  • Unzip/ Untar files

    I am remotely logged into a UNIX cluster at the university and attempting to manipulate some files that I have received from a collaborator. He has "tarred" and "zipped" the files. Unzipping the file with the command
    <remote host:directory>% gunzip file.tar.gz
    (remote host is the machine I am logged into (via ssh -X username): directory is my directory on the remote host)
    This creates the unzipped file- file.tar on <remote host:directory>. The problem arises when I attempt to untar the file. I am using the command
    tar -xvfp file.tar
    After entering this command, I get the message
    tar: can't mkdir /net: Permission denied
    tar extract: failed mkdir of <:senders directory>
    The same error is produced using [tar -xvf] as the bundled-options. I am assuming that it is attempting to make the directory on my collaborators remote host because the listed location of the failed mkdir is the senders directory <:senders directory> on a different UNIX cluster.
    I have tried variations on the tar command (-x or -xv) but those produce the error
    tar: tape read error: no tape in drive
    I am a bit unfamiliar with the syntax for the [[-]bundled-options Args] in the tar command, but I suspect that I need to specify where the untarred archive is going to be written/ copied. Could anyone provide some guidance on this.
    Sincerely,
    Aric

    Hi Aric,
       Did you copy the error message verbatim? Does it really want to create the directory, /net? If so then the problem is likely to be in the tarball itself.
       There's nothing wrong with your initial syntax. The -x tells tar to unpack the tarball, which is what you're trying to do. The -p says to preserve permissions, which is fine. The 'p' is not supposed to go after the 'f' in the options because the tarball, file.tar, is technically an argument of the -f option. However, most implementations of tar are rather forgiving in that regard. The -v option simply tells tar to be verbose and list the files. Of course there are many implementations of tar and you don't bother to tell us into what kind of machine you're logged.
       Tar has the ability to archive many files and preserve the directory structure. However, it has to recreate those directories when unpacking and that's when it had a problem. It seems that tar wants to create a directory named "net" at the root of the boot drive. I assume that the creator of the tarball archived such a directory on his machine.
       However, most implementations of tar strip the leading slash, turning an absolute path into a relative path. That way when unpacked, the directory structure starts at the current working directory. Unless you tried to unpack this tarball from the root directory of the boot drive, the tar that created this tarball appears to be different.
       Unless you can get the privilege of writing to the root of this boot drive, I would guess that your only recourse is to get the person who created the tarball to redo it using relative paths. See if you can get him to create it with GNU's tar, as that version strips the leading slashes by default.
    Gary
    ~~~~
       OK, so you're a Ph.D. Just don't touch anything.

  • Native extension to unzip a file crash my air app

    Hello,
    I have a problem with a native extension for android
    I want to unzip a file
    my java code
    File f = new File("my zip file");
    File outputDir = new File ("output folder");
    ZipHelper.unzip(f, outputDir);
    and
    import java.util.zip.*;
    import java.io.*;
    import java.util.Enumeration;
    import org.apache.commons.io.IOUtils;
    import android.util.Log;
    public class ZipHelper
    static public void unzip(File archive, File outputDir)
    try {
    Log.d("control","ZipHelper.unzip() - File: " + archive.getPath());
    ZipFile zipfile = new ZipFile(archive);
    for (Enumeration e = zipfile.entries(); e.hasMoreElements(); ) {
    ZipEntry entry = (ZipEntry) e.nextElement();
    unzipEntry(zipfile, entry, outputDir);
    catch (Exception e) {
    Log.d("control","ZipHelper.unzip() - Error extracting file " + archive+": "+ e);
    static private void unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) throws IOException
    if (entry.isDirectory()) {
    createDirectory(new File(outputDir, entry.getName()));
    return;
    File outputFile = new File(outputDir, entry.getName());
    if (!outputFile.getParentFile().exists()){
    createDirectory(outputFile.getParentFile());
    Log.d("control","ZipHelper.unzipEntry() - Extracting: " + entry);
    BufferedInputStream inputStream = new BufferedInputStream(zipfile.getInputStream(entry));
    BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
    try {
    IOUtils.copy(inputStream, outputStream);
    catch (Exception e) {
    Log.d("control","ZipHelper.unzipEntry() - Error: " + e);
    finally {
    outputStream.close();
    inputStream.close();
    static private void createDirectory(File dir)
    Log.d("control","ZipHelper.createDir() - Creating directory: "+dir.getName());
    if (!dir.exists()){
    if(!dir.mkdirs()) throw new RuntimeException("Can't create directory "+dir);
    else Log.d("control","ZipHelper.createDir() - Exists directory: "+dir.getName());
    i copy the file commons-io-2.4.jar (I get at http://commons.apache.org/proper/commons-io/download_io.cgi) in the lib folder of eclipse.
    in a native android app, this code work fine
    in a native extension for air, my air app crash
    LogCat in eclipse return
    NoClassDefFoundError: org.apache.comons.io.IOUtils.copy
    IOUtils class is not in commons-io-2.4.jar ???
    thanks

    Hello,
    I have a problem with a native extension for android
    I want to unzip a file
    my java code
    File f = new File("my zip file");
    File outputDir = new File ("output folder");
    ZipHelper.unzip(f, outputDir);
    and
    import java.util.zip.*;
    import java.io.*;
    import java.util.Enumeration;
    import org.apache.commons.io.IOUtils;
    import android.util.Log;
    public class ZipHelper
    static public void unzip(File archive, File outputDir)
    try {
    Log.d("control","ZipHelper.unzip() - File: " + archive.getPath());
    ZipFile zipfile = new ZipFile(archive);
    for (Enumeration e = zipfile.entries(); e.hasMoreElements(); ) {
    ZipEntry entry = (ZipEntry) e.nextElement();
    unzipEntry(zipfile, entry, outputDir);
    catch (Exception e) {
    Log.d("control","ZipHelper.unzip() - Error extracting file " + archive+": "+ e);
    static private void unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) throws IOException
    if (entry.isDirectory()) {
    createDirectory(new File(outputDir, entry.getName()));
    return;
    File outputFile = new File(outputDir, entry.getName());
    if (!outputFile.getParentFile().exists()){
    createDirectory(outputFile.getParentFile());
    Log.d("control","ZipHelper.unzipEntry() - Extracting: " + entry);
    BufferedInputStream inputStream = new BufferedInputStream(zipfile.getInputStream(entry));
    BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
    try {
    IOUtils.copy(inputStream, outputStream);
    catch (Exception e) {
    Log.d("control","ZipHelper.unzipEntry() - Error: " + e);
    finally {
    outputStream.close();
    inputStream.close();
    static private void createDirectory(File dir)
    Log.d("control","ZipHelper.createDir() - Creating directory: "+dir.getName());
    if (!dir.exists()){
    if(!dir.mkdirs()) throw new RuntimeException("Can't create directory "+dir);
    else Log.d("control","ZipHelper.createDir() - Exists directory: "+dir.getName());
    i copy the file commons-io-2.4.jar (I get at http://commons.apache.org/proper/commons-io/download_io.cgi) in the lib folder of eclipse.
    in a native android app, this code work fine
    in a native extension for air, my air app crash
    LogCat in eclipse return
    NoClassDefFoundError: org.apache.comons.io.IOUtils.copy
    IOUtils class is not in commons-io-2.4.jar ???
    thanks

  • When I unzip .zip files I get an alias ?

    I've unzipped .zip files for years, but with Lion, unzipping a .zip file (created in Snow Leopard) does not result in a set of files, it results in a set of aliases which do not point to any file when I select "Show Original."
    Any advice appreciated.

    The current version of the built-in Archive Utility has problems with some zip files. Use "The Unarchiver" instead -- free in the App Store.

  • Error when unzipping a file

    Im trying to unzip a program to jailbreak my iphone and when i try to unzip the file, i get the following error message.
    Unable to archive "greenpois0n-osx_rc5.zip" into "Downloads".
    (Error 1 - Operation not permitted.)
    How do i unzip this file?

    That's Great! How did you figure it out? I have the same problem.

  • Unzip .bz2 file

    Guys,
    Anyone knows how to unzip .bz2 file? I am having a problem on this to unzip the SFWgcc33.bz2 file.
    Thanks....

    You're probably going to need to install some dependencies, the sun download center has them all, then run pkgadd as below:
    Stole this code from:
    http://gcc.gnu.org/ml/gcc-help/2004-08/msg00022.html
         unzip $HOME/gcmn-1.0-pkg.zip
         unzip $HOME/gcc-2.95.3-pkg.zip
         unzip $HOME/gmake-3.79.1-pkg.zip
         sudo /usr/sbin/pkgadd -n -d SFWgcmn all
         sudo /usr/sbin/pkgadd -n -d SFWgcc all
         sudo /usr/sbin/pkgadd -n -d SFWgmake all

Maybe you are looking for

  • How to hide not all but a specific database on a SQL Server 2008 R2 instance?

    Hello everyone,       I need help from all the SQL Server database security experts out there. Any solution/help or work-around will be really appreciated. Here is the scenario; our client is using our application which is a windows forms application

  • Need to create 500 designs, all identical in every way except for a unique QR code

    Hi there. I am using Photoshop CS6. I have a design from which I want to create 500 versions of an image. All will be identical, except for the QR code which will be unique for every one. The placement of the QR code will be identical in all of them.

  • Updating to Xcode 4.0.2

    I have Xcode 4.0.1 installed from the MAS and whist the Xcode App Store page is showing that the latest version available is 4.0.2 this version is showing in the list of available updates? How can I update to this version?

  • Deploying Adobe Reader X update 10.1.4 ends in error 1310

    Hello, I try to update the reader installations in our company but on many clients it ends up with error 1310 (not enough rights to access C:\Config.msi-Folder). If I start the msp-file manually it throws about 10 exceptions that it cannot write or r

  • Latest record with a date

    I have a table where I store records of files (not the files themselves, more like the meta data). The files are edited and the new version (which is a new record in the table) has a new date and report_number_version. I'd like to pull only the lates