Can't open the Zipped file

Hi
I am making a zip file using GZIPOutputStream. But I am not able to open the zip file that is created using win zip.The size of the zipped file is 81 KB and the input file is 3,245 KB.I have closed all the streams still I am not able to figure out the problem.Any idea where I am going wrong ? Any help would be greatly appreciated.
Here my code goes:
import java.util.zip.*;
import java.io.*;
public class ZipFile
     public static void main(String[] args) throws FileNotFoundException,IOException
          ZipFile("D:\\Java\\Test\\INPUTXML_bkp_1.xml");
     public static String ZipFile(String fileName) throws FileNotFoundException,IOException
          String name = fileName.substring(fileName.lastIndexOf('\\') +1 ,fileName.lastIndexOf('.'));
          String filePath = fileName.substring(0,fileName.indexOf(name));
          String newFileName = new StringBuffer(name).append(".zip").toString();
          FileOutputStream outputStream = new FileOutputStream(newFileName);
          GZIPOutputStream zipOutputStream = new GZIPOutputStream(outputStream);
          FileInputStream inputStream = new FileInputStream(fileName);
          byte[] temp = new byte[10000000];
          int counter = inputStream.read(temp,0,temp.length);
          zipOutputStream.write(temp,0,counter);
          inputStream.close();
          zipOutputStream.finish();
          zipOutputStream.close();
          return newFileName;
Thanks
Ritesh

Thanks for the reply.
I changed my code to look like this:
import java.util.zip.*;
import java.io.*;
public class ZipFile
     public static void main(String[] args) throws FileNotFoundException,IOException
          ZipFile("D:\\Java\\Test\\INPUTXML_bkp_1.xml");
     public static String ZipFile(String fileName) throws FileNotFoundException,IOException
          String name = fileName.substring(fileName.lastIndexOf('\\') +1 ,fileName.lastIndexOf('.'));
          String filePath = fileName.substring(0,fileName.indexOf(name));
          String newFileName = new StringBuffer(name).append(".zip").toString();
          FileOutputStream outputStream = new FileOutputStream(newFileName);
          ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
          ZipEntry zipEntry = new ZipEntry(fileName);
          zipOutputStream.putNextEntry(zipEntry);
          zipOutputStream.finish();
          zipOutputStream.close();
          return newFileName;
Now I can atleast open the zip file. But the problem is the size of the file is 0 kb. Probably because, I am not populating the Zip entry. Can u pls let me know how do I do that.
Thanks
Ritesh

Similar Messages

  • I have a 2007 iMac with version 10.6.8.  When downloading "some" files to my computer, these files become "zip files."  When I open the zip file, it produces a document in some coding language. How can I open the file to produce a legible document?

    I have a 2007 iMac with version 10.6.8 and 4GB of expanded memory.  When downloading "some" emailed documents, the downloaded file becomes a "zip file," which when opened looks like a coded message.  How can I open the "zip file" so that it produces a legible document?  Please, help!!  thank you!!!

    A "zip file" is a compressed file. "Zipping" in principle does not and cannot change the contents. So that if the contents before zipping are garbage, or unreadable on a Mac, when you expand the file you will get garbage or an unreadable file.
    The first thing to verify therefore is whether the file, before it was zipped, was in a "Mac friendly" format. Can you do that?
    You do not need an App to zip or unzip. These functions are built in on our Macs.
    And yes, zipping and unzipping using the built in functionality, work fine in OS 10.6.8. And 10.7 and 10.8 and 10.9.

  • I have a Canon 5D Mk lll/Photoshop & Bridge CS6/Camera Raw 7.1 and I still can't open the CR2 files

    I have a Canon 5D Mk lll/Photoshop & Bridge CS6/Camera Raw 7.1 and I still can't open the CR2 files on my Canon.
    Any insight/wisdom would be much appreciated. Thanks

    When you try to open in PS what happens?
    In Bridge do you see icons or thumbnails?
    Will it open in ACR in Bridge?

  • I have Photoshop CS5 and a Nikon D 810 camera.  I have downloaded Camera Raw 8.8 & DNG converter.  I can neither open the raw files (.nef), nor process them with the DNG converter. What is going wrong?

    I have Photoshop CS5 and a Nikon D 810 camera.  I have downloaded Camera Raw 8.8 & DNG converter.  I can neither open the raw files (.nef), nor process them with the DNG converter. What is going wrong?  Thanks!

    This is the last paragraph from my very first response to you, post #1 in this thread:
    …Additionally, you need to install the DNG Converter, not just "download" it, and you need to launch it and run it on each folder of NEFs you wish to convert to raw DNGs.  [emphasis added]

  • I can't open the psd file I did yesterday! It says that the file is not compatible with this version of photoshop.

    I can't open the psd file I did yesterday! It says that the file is not compatible with this version of photoshop. I worked in a CS6 version but also tried opening in a CC but nothing happens. Help
    more info:
    Photoshop never crashed or anything.
    I was working in my school's mac but running windows, and the file was being saved in the school's network not on the computer. I thought it had been saved and I also copy and pasted the file in my hard drive to guarantee a copy but none of the are opening.
    The file size was appox. 1giga
    Thanks a lot

    The problem was saving over the network. Working across a network is not supported.
    This is the boilerplate text often used in connection to saving to a network (please NOTE the part where it explains that normally, it does work, but that it is impossible to troubleshoot someone else's network remotely, and that's why it's not supported by Adobe):
    If you are opening files over a network or saving them to a network server, please cease and desist immediately in the event you are currently experiencing problems with one or more files. Working across a network is not supported.
    See: 
    http://kb2.adobe.com/cps/406/kb406793.html
      Copy the CLOSED file from your server to your local hard disk, work on it, save it again to your local hard disk, close it, and copy the closed file back to the server.
        Of course, the fact that Adobe does not support working across a network does not necessarily mean it won't work.  It should.
        Adobe's position is that there are too many variables in a network environment for them to guarantee that everything will work correctly in every network, especially given the fact that if something does not work properly, it's probably the network's fault, and Adobe has no way of troubleshooting your network.
      If you can't work locally, you are on your own, and if something happens, you're on your own. If you must work from a server, make sure your network administrator is a competent professional.
    When problems arise, a lot of valuable work can be lost.

  • I can't open the RAW files from my new Nikon D4s camera in photoshop? How do I download the latest software for RAW files?

    I can't open the RAW files from my new Nikon D4s camera in photoshop? How do I download the latest software for RAW files? Cheers!

    What version of Photoshop are you running?  You will need at CS5, CS6, CC or CC2014.  Each version needs a different ACR-plug-in to open files from that camera.
    If you are on CS4 or earlier, you'll need to upgrade—or, in the alternative; look for, download, instal, launch and run the free, stand-alone DNG Converter 8.6 on each file of raw NEF files to convert them to raw DNGs first so you can open them in your version of Photoshop and ACR plug-in higher than 2.4.

  • I have just bought a Panasonic Lumix compact camera. Aperture and Preview can't open the RAW files from this camera. Panasonic recommend downloading 'SYLKPIX Developer Studio SE' to save RAW file formats.How can Aperture and Preview read the files?

    I have just bought a Panasonic Lumix compact camera. Aperture and Preview can't open the RAW files from this camera. Panasonic recommend downloading 'SYLKPIX Developer Studio SE' to save RAW file formats.How can Aperture and Preview read the files?

    Either use 'SYLKPIX Developer Studio SE' to develope the RAW files and to save them in another lossless format like TIFF, or try if Adobe's free DNG Coverter can convert your Lumix RAW files to dng. Then import the dngs. This way, your files will still be RAW files.  This works (most times) for my Lumix FZ28.
    Adobe DNG Converter 8.3  http://www.adobe.com/support/downloads/detail.jsp?ftpID=5695

  • Just bought Nikon D600, can't open the raw file from my Photoshop element 9, please adivise.  Thanks

    Can't open the raw file in my Photoshop Element 9 from my new Nikon D600, please help. many thanks
    Brian

    Hi,
    The D600 requires camera raw version 7.3 or later - that is not compatible with Photoshop Elements 9.
    You need to either
    1) upgrade to Photoshop Elements 11 or 12
    or
    2) you can download the free Adobe DNG converter to convert you NEF files to DNG files and then PSE 9 can read the DNG files
    The latest version of the DNG converter that you can use will depend on your operating system.
    For XP or Vista :
    DNG Converter 8.3
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=5694
    For Windows 7 or 8
    Adobe - Adobe Camera Raw and DNG Converter : For Windows : Adobe DNG Converter 8.5
    For Mac
    Adobe - Adobe Camera Raw and DNG Converter : For Macintosh : Adobe DNG Converter 8.5
    Brian

  • My Organizer can not open the catalog file it crash down.

    My Organizer can not open the catalog file it crash down.

    OS X Yosemite And PSE 13
    2015-01-16 8:24 GMT+01:00 Anwesha Dev Chaudhary <[email protected]>:
        My Organizer can not open the catalog file it crash down.  created by Anwesha
    Dev Chaudhary <https://forums.adobe.com/people/AnweshaDevChaudhary> in *Photoshop
    Elements* - View the full discussion
    <https://forums.adobe.com/message/7101754#7101754>

  • Can't Open the load file

    When i ran the HFM 11.1.2.1 automation task manually on Windows 2008R2 64-bit and taskflow initiated successfully but data didn,t load in HFM.
    We got the system message
    Error Code:{6C36C7E9-608F-4A86-A615-B37647AE55AD}
    System Message Summary
    Can't open the load file
    System Message Details
    Error Reference Number: {6C36C7E9-608F-4A86-A615-B37647AE55AD};User Name: admin@Native Directory
    Num: 0x800456c1;Type: 1;DTime: 5/8/2012 11:59:46 AM;Svr: SERV02;File: CHsvcDataLoad.cpp;Line: 1136;Ver: 11.1.2.1.000.3082;
    Num: 0x800456c1;Type: 0;DTime: 5/8/2012 11:59:46 AM;Svr: SERV02;File: HFMActionsExecution.cpp;Line: 1931;Ver: 11.1.2.1.000.3082;
    Num: 0x800456c1;Type: 0;DTime: 5/8/2012 11:59:46 AM;Svr: SERV02;File: HFMActions.cpp;Line: 72;Ver: 11.1.2.1.000.3082;
    Num: 0x800456c1;Type: 0;DTime: 5/8/2012 11:59:46 AM;Svr: SERV02;File: HFMCESAction.cpp;Line: 28;Ver: 11.1.2.1.000.3082;
    Num: 0x800456c1;Type: 0;DTime: 5/8/2012 11:59:46 AM;Svr: SERV02;File: Actions.cpp;Line: 385;Ver: 11.1.2.1.000.3082;
    Any help is much appreciated:
    Thanks:
    Kundan

    Downloadable installation files available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
    Lightroom:  5.7.1| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5.5, 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • How can I open the *.ps files?

    How can I open the *.ps files?

    Get GhostView or Adobe distiller... the first one is free to download, dunno about the distiller.

  • How can I open the windows file directory in "WHEN-BUTTON-PRESSED" trigger

    Dear All,
    How can I open the windows file directory in “WHEN-BUTTON-PRESSED” trigger?

    Blessan Joseph,
    The solution is dependent on your Forms version and if your applications is traditional Client/Server (CS) (Forms 6i and lower) or web deployed (Forms 6i and higher). For CS, you would use the Get_File_Name() built-in as Faa demonstrated. For Web, you will need to use the WebUtil library function Client_Get_File_Name() as Sarah (OGIR) demonstrated. Both of these functions will return the full path to a file. Note: WebUtil is an external library so it requires you to perform some configuration on your developer client as well as on the Application Server. WebUtil is included with Forms 9i and higher, but you must download it for Forms 6i.
    My requirement is user should able to select windows directory for the output.Do you really need to allow the user to write to a file in the Windows directory? This is very dangerous and you should not allow users or programs to write to the Windows directory. Users should only be able to write files to "User" directories (\My Documents\<Directory name>).
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • How can I open the .ase file?

    Can someone help me with this please?
    I am wondering how can I open the .ase file?

    I know that you can open them in Photoshop. Go to the swatch menu and choose "load swatches." I assume that the rest of the Creative Suite has a similar function. Make sure that you choose *.ase in the open window.

  • Can't open any zip Files

    BB 9780
    On a BES Server
    Can open any ZIP file for  my mail in the Playbook, any idea ?
    thanks
    yves

    We all have the same issue with not being able to open "zip" or "txt" attachments, I just sent customer support an email asking when we will get some type of list showing the reported bugs and some type of change list when they issue updates. We need to know what changes have been made when they issue OS updates.

  • Can't download the zip file

    I have been trying to download the zip file all day today and keep getting a "Page Cannot be displayed". Is the file available today?
    Please use this forum to provide feedback about OTN content/services. All other posts will be DELETED.

    OS X Mavericks: Open an app from an unidentified developer

Maybe you are looking for

  • Using Scripts in Oracle Weblogic Server

    Hello friends, I have a query in which I need to use scripts: setWLSEnv.sh? or setDomainEnv.sh? Thanks

  • Verbose logging jdk1.6 no longer contains path and file for loading msgs

    The javac verbose option underjdk 1.6 logs LOADING Line as follows: [javac] [loading javax\naming\InitialContext.class(javax\naming:InitialContext.class)] That is different that what I had been getting under jdk 1.5 [javac] [loading Z:\WebSphere\AppS

  • Invalid option for MAP: MAP.

    Hi , My replication file is running fine with below contents MAP PROD.f0911, TARGET PROD.f0911, & REPERROR (21000, EXCEPTION), & SQLEXEC (ID lookup, ON UPDATE, & QUERY "select count(*) conflict from PROD.f0911 where ID_NO = :p1 and & UPDT_DT > :p2",

  • Projects won't open

    Just as I finished a project, the program shut down with an error message.  I re-opened the program, but the project will not open.  It says "Loading project" but nothing happens.

  • What number to use on redeem gift card

    Sounds silly, but I've got a prepaid gift card and none of the numbers on the back are correct when I enter them to redeem. There is a bar on the back of the card that looks like it should be scratched to reveal something underneath (FastCard logo pl