Create Zip File In Windows and Extract Zip File In Linux

I had created a zip file (together with directory) under Windows as follow (Code are picked from [http://www.exampledepot.com/egs/java.util.zip/CreateZip.html|http://www.exampledepot.com/egs/java.util.zip/CreateZip.html] ) :
package sandbox;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
* @author yan-cheng.cheok
public class Main {
     * @param args the command line arguments
    public static void main(String[] args) {
        // These are the files to include in the ZIP file
        String[] filenames = new String[]{"MyDirectory" + File.separator + "MyFile.txt"};
        // Create a buffer for reading the files
        byte[] buf = new byte[1024];
        try {
            // Create the ZIP file
            String outFilename = "outfile.zip";
            ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
            // Compress the files
            for (int i=0; i<filenames.length; i++) {
                FileInputStream in = new FileInputStream(filenames);
// Add ZIP entry to output stream.
out.putNextEntry(new ZipEntry(filenames[i]));
// Transfer bytes from the file to the ZIP file
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
// Complete the entry
out.closeEntry();
in.close();
// Complete the ZIP file
out.close();
} catch (IOException e) {
e.printStackTrace();
The newly created zip file can be extracted without problem under Windows, by using  [http://www.exampledepot.com/egs/java.util.zip/GetZip.html|http://www.exampledepot.com/egs/java.util.zip/GetZip.html]
However, I realize if I extract the newly created zip file under Linux, using modified version of  [http://www.exampledepot.com/egs/java.util.zip/GetZip.html|http://www.exampledepot.com/egs/java.util.zip/GetZip.html] . The original version doesn't check for directory using zipEntry.isDirectory()).public static boolean extractZipFile(File zipFilePath, boolean overwrite) {
InputStream inputStream = null;
ZipInputStream zipInputStream = null;
boolean status = true;
try {
inputStream = new FileInputStream(zipFilePath);
zipInputStream = new ZipInputStream(inputStream);
final byte[] data = new byte[1024];
while (true) {
ZipEntry zipEntry = null;
FileOutputStream outputStream = null;
try {
zipEntry = zipInputStream.getNextEntry();
if (zipEntry == null) break;
final String destination = Utils.getUserDataDirectory() + zipEntry.getName();
if (overwrite == false) {
if (Utils.isFileOrDirectoryExist(destination)) continue;
if (zipEntry.isDirectory())
Utils.createCompleteDirectoryHierarchyIfDoesNotExist(destination);
else
final File file = new File(destination);
// Ensure directory is there before we write the file.
Utils.createCompleteDirectoryHierarchyIfDoesNotExist(file.getParentFile());
int size = zipInputStream.read(data);
if (size > 0) {
outputStream = new FileOutputStream(destination);
do {
outputStream.write(data, 0, size);
size = zipInputStream.read(data);
} while(size >= 0);
catch (IOException exp) {
log.error(null, exp);
status = false;
break;
finally {
if (outputStream != null) {
try {
outputStream.close();
catch (IOException exp) {
log.error(null, exp);
break;
if (zipInputStream != null) {
try {
zipInputStream.closeEntry();
catch (IOException exp) {
log.error(null, exp);
break;
} // while(true)
catch (IOException exp) {
log.error(null, exp);
status = false;
finally {
if (zipInputStream != null) {
try {
zipInputStream.close();
} catch (IOException ex) {
log.error(null, ex);
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException ex) {
log.error(null, ex);
return status;
*"MyDirectory\MyFile.txt" instead of MyFile.txt being placed under folder MyDirectory.*
I try to solve the problem by changing the zip file creation code to
+String[] filenames = new String[]{"MyDirectory" + "/" + "MyFile.txt"};+
But, is this an eligible solution, by hard-coded the seperator? Will it work under Mac OS? (I do not have a Mac to try out)
p/s To be honest, I do a cross post at  [http://stackoverflow.com/questions/2549766/create-zip-file-in-windows-and-extract-zip-file-in-linux|http://stackoverflow.com/questions/2549766/create-zip-file-in-windows-and-extract-zip-file-in-linux] Just want to get more opinion on this.
Edited by: yccheok on Apr 26, 2010 11:41 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Your solution lies in the File.separator constant; this constant will contain the path separator that is used by the operating system. No need to hardcode one, Java already has it.
edit: when it comes to paths by the way, I have the bad habit of always using the front slash ( / ). This will also work under Windows and has the added benefit of not needing to be escaped.

Similar Messages

  • Why CreateNewFrame() returns as NULL after successful created 136 child frame window and trying to create 137th child frame window in MDI application

    I am working on MDI application which was developed in VC++ in VS 2012. When my application is launched, it will display a Tree. Under a tree there are 254 nodes. Basically
    these nodes data are read from Configuration xml file and loaded into the Tree. By double clicking on each node, first it will create object for document class ( By calling CreateNewDocument() method) after that member variables for that
    document class will be initialized and then it will create the new frame window (by calling
    CreateNewFrame(pDoc,NULL). New child frame window will show under Main window to the user.
    User able to see the data from child frame window.
    Similarly by double clicking on each node it will create another object for the same document class and new child frame window will be opened for that node. Each child frame window runs
    in different data and showed under the Main window.
    Existing requirement by double clicking on each node, node data shall show in separate child window and there is no requirement for all 254 child windows opened simultaneously.
    But current requirement is , all 254 child windows shall open simultaneously by double clicking on each node one by one.
    In debug mode I have tried double clicking on each node. I able to open up to 50 nodes. After 50th child windows are opened, I unable to access to the application
    (Unable to open further node data window since application is getting hanged).
    Each child window is having tree, multiple splitter window and some additional controls (static text, ...).
    Same I have tried in release mode, I able to open up to 136 child windows. After that the application fail to create the new frame window in VS 2012. i.e CreateNewFrame() return
    NULL after successful created 136 child frame window. Debug purpose I have added the code to retrieve last error code by calling GetLastError() method. I got the value as "0". By closing any existing child window then I able to open remaining nodes.
    At any point of time I can reach maximum of 136 child frame window that can be opened under Main window. Failing to open all 254 child frame window
    simultaneously,  currently I fail to meet the current requirement.
    current Requirement is all 254 child frame window are opened simultaneously. Please let me know what may be the reason fail to create new frame window after 136 frame window that are
    opened already. In Microsoft site, mentioned that there is no limitation for creating frame  window in MDI application. I have tried another sample MDI application having limited number of controls, in which I able to create "n"
    number of child frame windows. why not able to create more than 136 child frame window in my actual application?
    Is there any possibility by changing project settings allow me to create 254 child frame window??
    Code Snippet as below:
    CDiagBaseDoc * CDiagBaseMDocTemplate::OpenDiagView( ...)
         CDiagBaseDoc* pDoc = NULL;
        if (pDoc == NULL)
            pDoc = (CDiagBaseDoc*)CreateNewDocument();
        if ( pDoc )
           CFrameWnd* pFrame = NULL;
           if (bAlreadyOpen)
                  // If Child frame window already opened, then handling the code here.
         else
               pFrame = CreateNewFrame(pDoc, NULL);
               if (pFrame == NULL)
                  ASSERT(FALSE);
                  delete pDoc;       // explicit delete on error
                 pDoc = NULL;
              ASSERT_VALID(pFrame);
              if( pDoc != NULL ) //VS2012
                 if ( !pDoc->OnNewDocument() )
                    TRACE0("CDocument::OnNewDocument returned FALSE\n");
                    delete pDoc;       // explicit delete on error
                    pDoc = NULL;
                    pFrame->DestroyWindow();
                     pFrame = NULL;
           if (pFrame)
               InitialUpdateFrame(pFrame, pDoc);
               ShowWindow( pFrame->GetSafeHwnd(), SW_MAXIMIZE ); //when opening node for the 1st time, maximize it
    }<o:p></o:p>

    Hi MuruganK,
    Have you checked how much memory your application used? You could check it by Task Manager. Maybe your application reach Memory Limits for Windows.
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
    Is it possible that there are some memory leaks in your application? It would better if you have made a simple sample to reproduce and narrow down this issue.
    Best regards,
    Shu
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Forms/Reports created using Oracle9iDS on Windows 2K deployed on Oracle9iAS on Linux

    I have got recently three Oracle Products namely, Oracle 9i Database, Oracle 9i Application Server (9iAS) and Oracle Internet Developer Suite (iDS). The Oracle 9i Database and Oracle 9iAS are installed on the RedHat Linux 7.3 Advanced Server. The Internet Developer Suite is for the MS Windows 98/2000 platform.
    My question is whether my application developed using Forms 6i and Reports 6i available with Internet Developer Suite, on the MS Windows 98/2000 platform can be deployed on the Oracle 9iAS on Linux. If yes, what are the issues involved in this? If not, do I need to re-develop my application using iDS on Linux?
    I would be grateful to get an early answer to my questions.

    Hi,
    Try open your fmb files on Linux 9iDS, if everything ok. Compile your form and try to run it.
    I didn't check it myself, but I migrate forms from 4.5 forms to 6i forms without problems.
    From Windows to Linux and back no problem, but you must remember to compile all forms for
    target operating system (Linux or Windows).
    Hope it helps,
    Roman.

  • Can you build an Labview app on windows and run it on the Linux Runtime Engine?

    Our developers work on windows workstations but we would like to convert our test stands to linux. Can we run the apps they develop on Linux with the Linux Runtime?

    No. VIs developed on Windows will run in the LabVIEW Linux development (assuming no Windows specific functions like ActiveX and DLL calls) but in order to run a built application on Linux you will need to rebuild them with the Linux application builder.

  • Java applet works in windows and does not work in linux

    Hello, guys!
    I'm working with site which is located in vpn network at work.
    I use browsers firefox 3 and opera.
    When I want to open java applet using firefox or opera at first everything is fine then on the last stage of loading(judging by progress bar) applet hangs(progress bar hangs) and when I reload page firefox shows in the bottom bar: applet <applet's name> bail.
    In windows everything works both in ie6 and firefox 3.
    On both environments I have the jre 6 installed.
    please help!

    Ok, I installed ies4linux and jre 1.5.16. I can work with that but when I start applet screen goes black and window frames dissapear.
    To solve this problem(feature?) I disabled DirectX-based acceleration for Java 2D but that works for javacpl.exe and does not work for my applet.

  • Want To create Zip file  using java,And Unzip without Java Program

    I want to create a zip text file using java, I know Using ZipOutputStream , we can create a zip file, , But i want to open that zip file without java program. suppose i use ZipOutputStream , then zip file is created But for unZip also difftrent program require. We cant open that zip file without writing diff java program.
    Actually i have one text file of big size want to create zip file using java , and unzip simply without java program.Its Possible??
    Here is one answer But I want to open that file normal way(
    For Exp. using winzip we can create a zip file and also open simply)
    http://forum.java.sun.com/thread.jspa?threadID=5182691&tstart=0

    Thanks for your Reply,
    I m creating a zip file using this program, Zip file Created successfully But when im trying to open .zip file i m getting error like "Canot open a zip file, it does not appear to be valid Archive"
    import java.io.*;
    import java.util.zip.*;
    public class ZipFileCreation
         public static void main (String argv[])
         try {
         FileOutputStream fos = new FileOutputStream ( "c:/a.zip" );
         ZipOutputStream zip = new ZipOutputStream ( fos );
         zip.setLevel( 9 );
         zip.setMethod( ZipOutputStream.DEFLATED );
    //     get the element file we are going to add, using slashes in name.
         String elementName = "c:/kalpesh/GetSigRoleInfo092702828.txt";
         File elementFile = new File ( elementName );
    //     create the entry
         ZipEntry entry = new ZipEntry( elementName );
         entry.setTime( elementFile.lastModified() );
    //     read contents of file we are going to put in the zip
         int fileLength = (int)elementFile.length();
         System.out.println("fileLength = " +fileLength);
         FileInputStream fis = new FileInputStream ( elementFile );
         byte[] wholeFile = new byte [fileLength];
         int bytesRead = fis.read( wholeFile , 0 /* offset */ , fileLength );
    //     checking bytesRead not shown.
         fis.close();
    //     no need to setCRC, or setSize as they are computed automatically.
         zip.putNextEntry( entry );
    //     write the contents into the zip element
         zip.write( wholeFile , 0, fileLength );
         zip.closeEntry(); System.out.println("Completed");
    //     close the entire zip
         catch(Exception e) {
    e.printStackTrace();
    }

  • Zip and extract multiple files using java program

    how can i zip and extract multiple files using java program.

    Hi,
    Look into the java.util.zip and java.util.jar they expose methods to manipulate zip and jar files.

  • Managing files in plsql -- create, zip and send more than 1 excel files

    Need a plsql code which will do the following.
    1. create multiple files in a certain location.
    2. zip them
    3. send the zip file to specific receipients.
    Can somebody help on this.
    Edited by: 862316 on Jul 5, 2011 12:32 AM

    Please read the FAQ first http://forums.oracle.com/forums/ann.jspa?annID=1535
    It addresses several things what one would need to know to be able to answer your question (see 'How to ask questions')
    Currently your question can not be answered.
    Sybrand Bakker
    Senior Oracle DBA

  • How create .ZIP, .RAR file on data export

    Dear All(s)
    On export in want to create .DMP and .RAR,ZIP files, How i can do this in Oracle 10.2.0.1
    EXP full=Y file=d:\abc.dmp
    Thanks in Advance

    For Linux, you can create shell script to export database and after that create .tar file from exported dump
    On Windows, you can create bat file to run export and then zip the dump file automatically
    On my blog, you can see an example of this procedure
    http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • Creating ZIP files of iPhoto 08 albums

    Very simply, how can I create a ZIP file of an iPhoto 08 album so that the pictures can be emailed?

    Very simply,
    Select the pic in the iPhoto Window and go File -> Export and export them to a Folder on the desktop. Zip and email that.
    Regards
    TD

  • Adobe Acrobat X Pro ZIP Compression Creates Larger Files

    Hello,
    I made a flyer in InDesign CS 6 which contains a fairly complicated vector image made with Illustrator. When I export to PDF, InDesign creates a file of the size of 26 MB (ish). I then run preflight in Acrobat which finds that the vector image isn't compressed.
    Note that my PDF settings in InDesign are set to bicubic subsampling for colour images that are above 450 px and JPG compression.
    When I tell Acrobat to apply fixes, it tries to apply ZIP compression but the file size is then 38 MB. Could anyone shed light on this for me please? There is obviously something basic about vector images and compression that I am missing.
    It also finds elements that are completely off the board, although I didn't put anything there with InDesign.

    Test Screen Name: After seeing your response I run a little test. I made a PDF straight from Illustrator just using that image then preflighted it and I got the same error.
    I then opened that same PDF in Illustrator, a lot of that artwork was turned into images. I think it's the transparency flattener as I am converting to PDF/X-1A with compatibility for Acrobat 4 (which I should have probably mentioned in the first post but I didn't make the connection between the two). As far as I understand the transparency flattener converts an image into a mix of paths and rasters (according to Adobe's own help files.)
    Preset used for preflight is sheetfed offset CMYK btw.

  • Creating zipped file which contain multiple files

    hi all,
    i have a problem which i would like some advice about:
    i need to recieve from a FTP server multiple files and then zip them all in one big zip file.
    now i checked the forums and all i found is using PayloadZipBean which in all the examples create a zip file with one .txt in it.
    is it possible to create multiple files in the zip using this module?
    another problem if the one big zip file is what if each of the files inside the zip file has it's own mapping...
    i think a BPM is a must here and a parallel one also with a correlation...
    i would like if it's possible to do something different as the correlation between the files is a bit complicated?
    regards and thanks a lot,
    Roi Grosfeld

    First,
    I would like to understand your requirement. Is it to only download and zip the files in to one file? XI is not the solution. A OS level script or some C program is what I would use for that which calls some FTP APIs.
    If you requirement is to get different files with different format but want to send them to one desintation which accepts files in only one format, I would not consider zipping them into one file and again unzipping then and executing a mapping XI. Instead, I would have different file adapter for each type of the file and use as many sender agreements with diffrent mappings.
    Hope it made some sense..!!
    VJ

  • Error when creating ZIP file (return value 2 when IGS was called)

    Hello All
    I attempted to Schedule a Query to the Portal folders and executes fine.  However when it's scheduled to and email, I am getting this message
    'Error when creating ZIP file (return value 2 when IGS was called)'
    Any ideas?
    Thanks ...BK

    Hello Kai
    Thanks very much for the info.  how would I know what patch the IGS is?
    Thank you.
    Regards..BK

  • Creating zip files in pl/sql.

    I'm using code posted on this forum to create zip file in pl/sql. Works greate for combing multiple files into one archive. That's until I have to add a zip file.
    Here's my test:
    drop table t1;
    create table t1 (file_name varchar2(100), file_blob blob);
    declare
    v_new_blob blob;
    v_file_name varchar2(100);
    v_buffer_raw raw(1000);
    v_length integer;
    b_zipped_blob BLOB;
    zip_files zz_zip.file_list;
    t_file blob;
    begin
         dbms_lob.createtemporary(v_new_blob,true);
         v_buffer_raw := UTL_RAW.cast_to_raw('AAAA');
         v_length := UTL_RAW.length(v_buffer_raw);
         dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
         insert into t1 values ('tmp\FileA.txt',v_new_blob);                         
         dbms_lob.freetemporary(v_new_blob);
         dbms_lob.createtemporary(v_new_blob,true);
         v_buffer_raw := UTL_RAW.cast_to_raw('BBBBBBBBB');
         v_length := UTL_RAW.length(v_buffer_raw);
         dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
         insert into t1 values ('tmp\FileB.txt',v_new_blob);                         
         dbms_lob.freetemporary(v_new_blob);
         dbms_lob.createtemporary(v_new_blob,true);
         v_buffer_raw := UTL_RAW.cast_to_raw('CCCCCCCCCCCCC');
         v_length := UTL_RAW.length(v_buffer_raw);
         dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
         insert into t1 values ('tmp\FileC.txt',v_new_blob);                         
         dbms_lob.freetemporary(v_new_blob);
         dbms_lob.createtemporary(v_new_blob,true);
         v_buffer_raw := UTL_RAW.cast_to_raw('DDDDDDDDDDDDDDDDDDDDDDDDDD');
         v_length := UTL_RAW.length(v_buffer_raw);
         dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
         insert into t1 values ('tmp\FileD.txt',v_new_blob);                         
         dbms_lob.freetemporary(v_new_blob);     
         commit;
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'tmp\FileA.txt';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'tmp\FileB.txt';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'tmp\FileC.txt';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         zz_zip.finish_zip(b_zipped_blob);
         zip_files := zz_zip.get_file_list( b_zipped_blob );
         for i in zip_files.first() .. zip_files.last
         loop
              dbms_output.put_line( zip_files( i ) );
         end loop;
         dbms_output.put_line('--');      
         -- Output
         FileA.txt
         FileB.txt
         FileC.txt
         -- Save zip in t1
         insert into t1 values ('ZipZZ.zip',b_zipped_blob);
         commit;     
         -- Create new zip file and add ZipZZ.zip and FileD.txt
         b_zipped_blob := null;
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'ZipZZ.zip';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'tmp\FileD.txt';
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         zz_zip.finish_zip(b_zipped_blob);
         zip_files := zz_zip.get_file_list( b_zipped_blob );
         for i in zip_files.first() .. zip_files.last
         loop
              dbms_output.put_line( zip_files( i ) );
         end loop;
         dbms_output.put_line('--');      
         /* output
         ZipZZ.zip
         tmp\FileD.txt
         -- save ZipXX.zip
         insert into t1 values ('ZipXX.zip',b_zipped_blob);
         commit;     
    end;
    --Test with other zip files.
    insert into t1 values ('File1.zip',null);
    commit;
    -- I've created a small zip file File1.zip using Winzip. It contains only 1 small text file File1.txt
    -- I use toad to insert into blob column.
    declare
    v_new_blob blob;
    v_file_name varchar2(100);
    v_buffer_raw raw(1000);
    v_length integer;
    b_zipped_blob BLOB;
    zip_files zz_zip.file_list;
    t_file blob;
    begin
         select file_name, file_blob into v_file_name, v_new_blob
              from t1 where file_name = 'File1.zip';
         dbms_output.put_line('Blob length: '||dbms_lob.getlength(v_new_blob));
         zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);     
         zz_zip.finish_zip(b_zipped_blob);
         zip_files := zz_zip.get_file_list( b_zipped_blob );
         for i in zip_files.first() .. zip_files.last
         loop
              dbms_output.put_line( zip_files( i ) );
         end loop;
         dbms_output.put_line('--');
         -- save new file as Zip1.zip
         insert into t1 values ('ZipFF.zip',b_zipped_blob);
         commit;     
    end;      
         Output
         Blob length: 1855
         File1.zip
         File1.txt
    Now, new zip file contains both File1.zip and File.txt.
    My expected result was just File1.zip
    Thanks.

    Your first example looks like I would expect (or do I miss something?).
    Your second example is strange, but it I can't reproduce it. If I zip a zipfile with my package it contains only the zipfile:
    declare
      my_zip blob;
      new_zip blob;
      zip_files as_zip.file_list;
      function file2blob(
        p_dir in varchar2
      , p_file_name in varchar2
        return blob
      is
        file_lob bfile;
        file_blob blob;
      begin
        file_lob := bfilename( p_dir
                             , p_file_name
        dbms_lob.open( file_lob
                     , dbms_lob.file_readonly
        dbms_lob.createtemporary( file_blob
                                , true
        dbms_lob.loadfromfile( file_blob
                             , file_lob
                             , dbms_lob.lobmaxsize
        dbms_lob.close( file_lob );
        return file_blob;
      exception
        when others
        then
          if dbms_lob.isopen( file_lob ) = 1
          then
            dbms_lob.close( file_lob );
          end if;
          if dbms_lob.istemporary( file_blob ) = 1
          then
            dbms_lob.freetemporary( file_blob );
          end if;
          raise;
      end;
    begin
      my_zip := file2blob( 'MY_DIR', 'as_fop.zip' );
      dbms_output.put_line('zip file to start with');
      zip_files := as_zip.get_file_list( my_zip );
      for i in zip_files.first() .. zip_files.last
      loop
        dbms_output.put_line( zip_files( i ) );
      end loop;
      dbms_output.put_line('--');
    --  now create a new zip file containing the existing zip file as_fop.zip
      as_zip.add1file( new_zip, 'as_fop.zip', my_zip );
      as_zip.finish_zip( new_zip );
    --  see what's in the new zip
      dbms_output.put_line('zip file containing a zipfile');
      zip_files := as_zip.get_file_list( new_zip );
      for i in zip_files.first() .. zip_files.last
      loop
        dbms_output.put_line( zip_files( i ) );
      end loop;
      dbms_output.put_line('--');
    end;
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    zip file to start with
    as_fop.sql
    zip file containing a zipfile
    as_fop.zip
    PL/SQL procedure successfully completed.
    ANTON@XE>Anton

  • Differences on Windows and Linux JVM about java.util.zip package

    Hello, there!
    I need some help if someone else has already face this problem.
    I have a Java server that process the bytes of a SWF File stored in the server and ouptut it to the user through a Servlet. The file was decompressed and re-compressed using the java.util.zip package (Deflater/Inflater).
    Everything works fine on Windows Server 2008 server. But now we need to migrate the server to Linux. The problem is that when I test the website now, the file seens to be corrupted.
    What really intrigues me is that everything runs normal on Windows Server configuration, when changed to Linux, the final file seens to be corrupeted... what could possible be the cause? Is there any difference between java.util.zip package on Window and Linux JVM?
    My Windows Server is:
    . Windows Server 2008 (6.0 - x86)
    . Apache 2.2.11
    . Tomcat 6.0.16.0
    . Java JDK 1.6.0_12-b04
    My CentOS Server is
    . CentOS 5.4 (2.6.18-164.15.1.el5 - i386)
    . Apache 2.2.3
    . Tomcat 6.0.16.0
    . Java JDK 1.6.0_12-b04
    Please, if someone could give me a lead, I would appreciate very much!
    Thank you all in advance,
    CaioToOn!

    ejp wrote:
    Thank you for the answer, but no. The path is correct.That's not what he meant. Zip file/directory entries are supposed to use / as the path separator. It is possible to use \ but such Zip files will only work under Windows. You may have erred here.Ohhh, I had really missunderstood what Ray said. But, I still think that this is not the problem, since the ZIP is a single SWF file generated by Flex SDK 3.4 and compressed in the ZLIB open standard (as in page 13, at [http://www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v9.pdf|http://www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v9.pdf] ). This is how Flash Compiler compress the files.
    jschell wrote:
    If the above suggestions do not solve the problem...Specify in detail with the exact steps used how you determined that it was corrupted.The reason why I believe the SWF is getting corrupted is that when it is loaded by Flash Player (in the client-side) the Player throws a VerifyError: Error # 1033. The [documentation says (see error 1033)|http://help.adobe.com/en_US/AS3LCR/Flash_10.0/runtimeErrors.html] that this error means that the SWF file is corrupted.
    As I said, what intrigues me is that this work perfectly in a Windows Server 2008 server. I just had setup a CentOS server and deployed the application. The client-remains unchanged, so why could the result change?
    raychen wrote:
    I would remove the side effect you are doing and send the file straight through, with decompress and compress, the servlet. It is more likely that you have a bug in your swf processor than the zip library.
    I had already tried it when first coding, in Windows Server 2008, it had not worked.
    Thank you all for the help.
    CaioToOn!

Maybe you are looking for

  • Unable to run my application using java web start

    i have created one application and use java web start to download the application. all the files are succesfully downloaded but when i try to run the application an expected error occur. this only happen in my machine but not in other machine i'm cur

  • Solution to k7n420 not booting

    My system turned off last week and refused to turn back on.   The power button would not work, but I assumed that the motherboard was still fine because while the PS was switched on, my keyboard still had LEDs lit.  I figured that this was probably a

  • Mini 210-3080NR dont accept bluetooth + wifi card from another HP Mini !?

    i am have purchased  one new HP Mini 210-3080NR and this have only wifi mini pci-e and need a bluetooth on this to use with my phones,i am have another mini HP models as > 210-1076NR and 110-3130NR and this 2 models have the same mini pci-e bluetooth

  • Flash intros in iweb??

    i recently heard of flash intros and was wondering if they could somehow be installed on iweb. I know iweb will not let you access the root html so if you anything it would be a great help. -austin

  • Thinking about moving to LR 5

    I'd like to move out of iPhoto to a more sophisticated photo management program.  I have friends who use Photo Mechanic, but Lightroom seems like a much better choice.  I've done the preliminary research and it seems I need to go through Photoshop El