Problem in creating zip file.

Hi,
I am using the zip package to create a zip file.The code is given below :
  ZipOutputStream out = new ZipOutputStream(new
  BufferedOutputStream(new FileOutputStream("d:\\abc\\target.zip")));
    byte[] data = new byte[1000];              
    BufferedInputStream in = new BufferedInputStream
(new FileInputStream("d:\\abc\\xyz.log"));
    int count;
   out.putNextEntry(new ZipEntry("d:\\abc\\target.zip"));
   while((count = in.read(data,0,1000)) != -1)
   out.write(data, 0, count);
   in.close();
   out.flush();
   out.close();The problem is that the zip file created is having no files when i try to zip files from locations other than the program file location ie other than current drive.
Could you please suggest me a solution so that it zips file from any location. Thanks in advance.

BRAVO wrote:
Hi,
I am using the zip package to create a zip file.The code is given below :
ZipOutputStream out = new ZipOutputStream(new
BufferedOutputStream(new FileOutputStream("d:\\abc\\target.zip")));
byte[] data = new byte[1000];              
BufferedInputStream in = new BufferedInputStream
(new FileInputStream("d:\\abc\\xyz.log"));
int count;
out.putNextEntry(new ZipEntry("d:\\abc\\target.zip"));
while((count = in.read(data,0,1000)) != -1)
out.write(data, 0, count);
in.close();
out.flush();
out.close();The problem is that the zip file created is having no files when i try to zip files from locations other than the program file location ie other than current drive.
Could you please suggest me a solution so that it zips file from any location. Thanks in advance.My advice would be to tryout something as given below and checkout whether that can
a). Give you Exception Message/stack trace if an error has occured
b). Check whether the appropriate code change works
public compressFile(String inputFile,String destFile){
ZipOutputStream out = null;
byte[] data = null;
BufferedInputStream in = null;
try{
    out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destFile)));
    data = new byte[1024];
     try{               
         in = new BufferedInputStream(new FileInputStream(inputFile));
         int count = -1;
         out.putNextEntry(new ZipEntry(inputFile));
         while((count = in.read(data)) > 0){     
            out.write(data, 0, count);
       }catch(Exception e){
           System.err.println(e.getMessage());
           e.printStackTrace();
       }finally{       
              if(in != null)
                 try{in.close();}catch(Exception ex){}
   out.flush();
}catch(Exception exp){
    System.err.println(exp.getMessage());
    exp.printStackTrace();
}finally{
  if(out != null)
     try{out.close();}catch(Exception e){}
   out = null;
   in = null;
}in order to compress the file we can call the method something like
compressUtilObj.compressFile("d:\\abc\\target.zip","d:\\abc\\xyz.log");Hope that helps :)
REGARDS,
RaHuL

Similar Messages

  • 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.

  • Problem in creating text file from report file

    Hello Everybody...
    I have problem in creating text file.
    I had set System Parameter as below
    DESTYPE : File
    MODE : Character
    DESNAME : gayu.txt
    And ruler setting
    Units : Character Cells
    Character Cell Size : Horiziontal = 7
    Vertiacle =12
    GridSpacing : 1
    no of snap points per grid spacing : 1
    but when i run report it will give error
    "REP_1219 M_2 or R_2 has no size -- length or width zero"
    so is there any solution of that
    or another way to convert report into text file?....

    Hi Folks,
    Please don't go after that Error as its a very deceptive one. Please don't go for altering your design Or changing the size of items in your layout.
    Similar errors I have come across in reports. I think its due to file transfer type. You might have transferred the file in Binary and your File Mode I am seeing it as CHAR.
    This normally happens while making the Report Format as "Text". Either you change that format which I think is possible in your case as your basic requirement is making a report output of CHAR type.
    Please check for this error in Metalink and proceed accordingly. I could fix similar errors when I changed Format type to PDF(from text).
    Regards
    Shibu

  • Problem in creating csv file

    I have one problem in creating csv file.
    If one column has single line value, it is coming in single cell. But if the column has no.of lines using carriage return while entering into the table,
    I am not able to create csv file properly. That one column value takes more than one cell in csv.
    For example the column "Issue" has following value:
    "Dear
    I hereby updated the Human Resources: New User Registration Form Request.
    And sending the request for your action.
    Regards
    Karthik".
    If i try to create the csv file that particular record is coming as follows:
    0608001,AEGIS USERID,SINGAPORE,Dear
    I hereby updated the Human Resources: New User Registration Form Request.
    And sending the request for your action.
    Regards
    Karthik,closed.
    If we try to load the data in table it is giving error since that one record is coming in more than one line. How can I store that value in a single line in csv file.
    Pls help.

    I have tried using chr(10) and chr(13) like this......still it is not solved.
    select REQNO ,
    '"'||replace(SUBJECT,chr(13),' ')||'"' subject,
    AREA ,
    REQUESTOR ,
    DEPT ,
    COUNTRY ,
    ASSIGN_TO ,
    to_Date(START_DT) ,
    START_TIME ,
    PRIORITY ,
    '"'||replace(issues, chr(13), ' ')||'"' issues,
    '"'||replace(SOLUTIONS,chr(13),' ')||'"' SOLUTIONS ,
    '"'||replace(REMARKS,chr(13),' ')||'"' REMARKS ,
    to_date(CLOSED_DT) ,
    CLOSED_TIME ,
    MAN_DAYS ,
    MAN_HRS ,
    CLOSED_BY ,
    STATUS from asg_log_mstr
    Pls help.

  • 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

  • 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();
    }

  • 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

  • A strange problem using the zip files

    I'm currently working on a university project with another student in which we use zip files (using the java ZipFile , and ZipOutputStream classes), we write certain data to a zip file (and verify that it is there by checking the disk). and later we read the zip file, and write it back , appending some data at the end of the file.
    although we see the changes actually take place on the disk , in one of the cases when reading the data we don't see the data we have appended before (although it is physically written on the disk).
    testing has revealed that this has something to do with the rename command or java being unsynchronized with the data actually on the disk (caching problem?).
    we use this code to preform the process:
    ZipFile zf= new ZipFile( ((Integer)lexicon.get(keyword)).intValue()+".zip");
              BufferedInputStream input= new BufferedInputStream(zf.getInputStream(new ZipEntry("data")));
              // create a temporary new zip file.
              ZipOutputStream zipst= new ZipOutputStream(new FileOutputStream( ((Integer)lexicon.get(keyword)).intValue()+".tmp.zip"));
              BufferedOutputStream output =new BufferedOutputStream(zipst);
              zipst.putNextEntry(new ZipEntry("data"));
              // stream the contents of the old file into the new file
              //(we do it this way because of the inability of the java zip file interfaces to add to an existing zip file)
              int current = input.read();
              while(current!=-1){
              output.write(current);
              current = input.read();
              output.write(entry.getBytes(false)); // add the new entrys.
              output.flush();
              zipst.closeEntry();
              output.close();
              // erase the old file.
              File toErase = new File( ((Integer)lexicon.get(keyword)).intValue()+".zip");
              toErase.delete();
              // rename the temporary file to the old files name.
              File toRename = new File( ((Integer)lexicon.get(keyword)).intValue()+".tmp.zip");
              toRename.renameTo(new File( ((Integer)lexicon.get(keyword)).intValue()+".zip"));
    we use:
    1. j2sdk 1.4.2_05
    2. running under libranet linux.
    any help will be appreciated

    the data does indeed get lost in the course fo rewriting the file, e assume this is some sort of synchronization issue with java and the file system.
    addig enteies to an existing zip file would have been great, if we had it a few weeks ago , we had to make do without this ability , and all of the code is already written and mostly working (except for the problem I mention) and we don't really want to rewrite the zip file access.
    additional testing has shown that the data gets lost when we use the rename command.
    very strange...
    thanks for the input

  • 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

  • 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

  • Failed to create zip file - did not free space

    Hi,I tried to zip the inside of my camera folder and naturally did not have enough space.1. Creation of the zip file failed.2. Shows me that there is no more room left on device, i.e. the space was not freed.3. Can not locate the zip file it tried to create (it did not appear in the same folder as "camera" and can't find it anywhere else either). Can anyone help, please, can't copy files anywhere because no space left and don't want to delete anything. Thanks in advance,Dario

    In regards to your original problem, but I can see two solutions without Link. 1, get an SD card and transfer some content over. The phone has finite space and this is the only way you can access storage from a computer without Link, so it is then only way to back up files (did I mention that is important yet?). 2, download Ghost Commander from the app world. It is a vastly more powerful file browser that can allow you to see your device storage particulars. I have none idea where a temporary ZIP file is located however, so this is not choice #1.

  • Want to view the created zip file via Bursting in Oracle Apps

    Hello,
    I' ve created a Bursting control file and invoked the concurrent request (XML Publisher Report Bursting Program, XDOBURSTREP) within the after-report trigger in oracle reports.
    My Bursting-Control file as follows:
    <xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi" type="bursting">
    <xapi:request select="/XXMI_OM_QUOTE/LIST_G_ORDERS/G_ORDERS">
    <xapi:delivery>
    <xapi:filesystem id="file1" output="/usr/tmp/DEV1/${QUOTE_NO}"></xapi:filesystem>
    </xapi:delivery>
    <xapi:document output-type="pdf" delivery="123">
    <xapi:template type="xsl-fo" location="xdo://XXMI.XXMI_OM_QUOTE.en.US">
    </xapi:template>
    </xapi:document>
    </xapi:request>
    </xapi:requestset>
    It works fine. e.g. Bursting creates two pdf-files and one zip file in unix, which I can see when pushing the View Output of the request(XML Publisher Report Bursting Program):
    <?xml version="1.0" encoding="UTF-8" ?>
    - <BURS_REPORT>
    <REQUESTID>643527</REQUESTID>
    <PARENT_REQUESTID>643525</PARENT_REQUESTID>
    <REPORT_DESC>XXMI OM Quote</REPORT_DESC>
    <OUTPUT_FILE>/u00/erp/dev1APP/inst/apps/DEV1/logs/appl/conc/out/o643527.zip</OUTPUT_FILE>
    - <DOCUMENT_STATUS>
    <KEY />
    <OUTPUT_TYPE>pdf</OUTPUT_TYPE>
    <DELIVERY>FILESYSTEM</DELIVERY>
    <OUTPUT>/usr/tmp/DEV1/10000012.pdf</OUTPUT>
    <STATUS>success</STATUS>
    <LOG />
    </DOCUMENT_STATUS>
    - <DOCUMENT_STATUS>
    <KEY />
    <OUTPUT_TYPE>pdf</OUTPUT_TYPE>
    <DELIVERY>FILESYSTEM</DELIVERY>
    <OUTPUT>/usr/tmp/DEV1/10000026.pdf</OUTPUT>
    <STATUS>success</STATUS>
    <LOG />
    </DOCUMENT_STATUS>
    </BURS_REPORT>
    But instead of this XML-output I wish a link to the file on unix. How can I link <OUTPUT_FILE>/u00/erp/dev1APP/inst/apps/DEV1/logs/appl/conc/out/o643527.zip</OUTPUT_FILE> within the view Output-Button of this request?
    Thanks in advance for any clues

    That is not how bursting works in EBS.
    The View Output from XDOBURSTREP is the Bursting Status Reprot.
    The bursted results are (potentially) multiple files so cannot be linked to view output.
    Depending upon the delivery channel chosen you have to either read the email, check the fiel system or printer, to see the results.
    The delivery channel bypasses the standard EBS request view.
    Kevin

  • Problem while Creating Control files while Cloning the Oracle DB

    Hi,
    I am failrly new to Oracle Administration. I have got the task of cloning our Production database into a new machine. With the help of various articles found over the web I have followed the below mentioned steps
    1)Executed the Alter database command for getting the control file copy.
    2) Taken the Datafiles,Control and redo log files copies into the Target machine.
    3) Copied the Pfile with the neccessary changes into the target machine.
    4) Edited the Create Control file syntax (generated from step 1) and executed the same on the target machine.
    Now the problem I face is that I get the following error while executing the create Control file syntax
    a)ORA-01503 - Creation of Controlfile failed.
    b) ORA-00219 - Required controlfile size 41760 exceeds max allowable size 20000.
    I am really stuck. Both my machine configurations and O/S installed are the same.
    Please advice me on how to Proceed... Thanking you all in advannce.
    Rgds,
    SN.

    Hi Jaffer,
    This is my code........ The control file has been generated by executing the syntax alter database backup controlfile to trace at the source db .
    STARTUP NOMOUNT pfile=ORADATA:ORAHOME1\ADMIN\ORACLE\PFILE\INIT.ORA;
    CREATE CONTROLFILE set DATABASE "ORACLE" RESETLOGS NOARCHIVELOG
    MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXDATAFILES 32
    MAXINSTANCES 16
    MAXLOGHISTORY 65535
    LOGFILE
    GROUP 1 'ORADATA:ORAHOME1\ORADATA\ORACLE\LOG2ORCL.ORA' SIZE 200K,
    GROUP 2 'ORADATA:ORAHOME1\ORADATA\ORACLE\LOG1ORCL.ORA' SIZE 200K
    DATAFILE
    'ORADATA:ORAHOME1\ORADATA\ORACLE\SYS1ORCL.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\USR1ORCL.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\RBS1ORCL.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BTXIS_DATA.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BTXIS_INDEX.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BTXIS_KAN_DAT.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BTXIS_KAN_INDEX.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BTXIS_KIS_DATA.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BTXIS_KIS_INDEX.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BTXIS_LUB_DATA.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BIMBJ01.DBF',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BIMAT01.DBF',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BITPA01.DBF',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BLUBFSINDEFX01.DBF',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\TEMP01.DBF',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\BTXIS_TOOLS.ORA',
    'ORADATA:ORAHOME1\ORADATA\ORACLE\IMPORT1.DBF'
    CHARACTER SET WE8ISO8859P1
    # Recovery is required if any of the datafiles are restored backups,
    # or if the last shutdown was not normal or immediate.
    #RECOVER DATABASE
    # Database can now be opened normally.
    #ALTER DATABASE OPEN;
    # No tempfile entries found to add.
    #

  • Problem while creating metadata files

    I created metadata files to add styles to Photoshop Elements 8 (in Windows 7) and included them in the C:\Program Data\Adobe\Photoshop Elements\8.0\Photo Creations\layer styles folder.  The first several worked great and successfully showed up in the Styles Palette.  Later, when I was trying to add more styles I received a message in PSE 'Could not load styles because the file could not be found'.  I closed PSE.  Now every time I open Editor I receive this message and it locks up the program.  The only way I can close PSE is through Task Manager.
    Any suggestions on how to correct this?

    I put a copy of the third party styles in the Photoshop Elements Preset/styles folder and in the Photoshop Elements 8.0/Photo Creations/layer styles folder.  From the Photo Creations/layer styles folder I selected an existing metadata file and copied it to my desktop.  I changed the first part of the file name to the name of the new style (example: glitter 001.metadata).  I then right clicked and opened with Notepad.  When I found the name of the existing file I was using, I changed the name before the equation sign to the name of my new layer style with no spaces between words.  Then I changed the name after the equation sign to the name of the new style with spaces between words (glitter001=glitter 001).  I then deleted the lines below this except for the line /PSEContent leaving one space between the lines.  I saved and closed the document.  I then put the saved file in the Photo Creations/layer style folder.  When I started PSE I held down the sift key when I selected Editor.  As I said, the first two I did showed up fine.  The next ones is where I had the problem.
    I did all of this in the Admin account.  When I go into my user account, PSE works but now I am afraid to try to add the layer styles.

  • Problem to create Excel file

    Hi,
    I'm to create Excel file by C# codes and have got this
    Error 1 Assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' uses 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' which has a higher version than referenced assembly 'office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
    Error 2 Assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' uses 'Microsoft.Vbe.Interop, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' which has a higher version than referenced assembly 'Microsoft.Vbe.Interop, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
    using these codes
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.IO;
    using System.Text.RegularExpressions;
    using System.Globalization;
    using System.Collections;
    using System.Diagnostics;
    using System.Drawing;
    using Microsoft.Office.Interop;
    using Excel = Microsoft.Office.Interop.Excel;
    namespace ns1
    class Program
    static void Main(string[] args)
    string orp_path = "//ABC";
    bool allowappend = true;
    string test = "test";
    Excel.Application app = null;
    Excel.Workbook workbook = null;
    Excel.Worksheet worksheet = null;
    Excel.Range workSheet_range = null;
    object misValue = System.Reflection.Missing.Value;
    Excel.Application xlApp = new
    Microsoft.Office.Interop.Excel.Application();
    workbook = xlApp.Workbooks.Add(misValue);
    workbook = xlApp.Workbooks.Add(misValue);
    worksheet = (Excel.Worksheet)workbook.Worksheets.get_Item(1);
    worksheet.Cells[1, 1] = "Run Date";
    workbook.SaveAs("c:\\" + test + ".xls", Excel.XlFileFormat.xlOpenXMLTemplate, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
    workbook.Close(true, misValue, misValue);
    xlApp.Quit();
    releaseObject(worksheet);
    releaseObject(workbook);
    releaseObject(xlApp); ...
    on VS 2013. Any advice?
    Many Thanks & Best Regards, Hua Min

    Hey,
    Not sure what the problem is, I got the code working.
    One thing you're doing wrong though: Excel.XlFileFormat.xlOpenXMLTemplate supposes you're using the file extension ".xlsx" (Open XML format) and not ".xls" (Microsoft Excel 97-2003).
    So you should start by changing either the extension to xlsx or the XlFileFormat to
    xlExcel8.
    For further reference take a look
    here

Maybe you are looking for

  • How can i transfer my data from samsung s2 to iPhone 5s

    Does anyone now what the quiest and easiest way is to transfer all my data form samsung s2 tot iphone 5s?

  • Intel GMA950 and system RAM

    I'm trying to make sense of the actual RAM used by the video system on my mini. There are some clues at http://docs.info.apple.com/article.html?artnum=303407 - but I want to dig a bit deeper... At the moment, on my mini - both vm_stat and the Activit

  • How to make form objects dynamically fit into window sizes?

    Hi, Form objects are always static. i.e, stick to the disigning time window size/resolution. When the resolution changes, the form objects will not strech to the new window size. Many of the clients are unhappy with this incapable feature. Is there a

  • My Unit Converter Widget is not right

    I'd been stop using Unit Converter widget from Dashboard since many months ago, now it's getting very inconvenient for me because even after many OS X updates, my Unit Converter shows wrong information of the currency conversion. Here's a screen capt

  • Kernel26MM: 100% CPU use, non-stop?

    I just installed the latest MM kernel, and discovered that, after half an hour of uptime or so, the CPU usage jumps to 100% and refuses to come back down. Listing the running processes shows me that none of them are eating up that much CPU time. (Yes