Editing Zip File Problem

Hi All
I want to write a program to edit an entity in a zip file
When I tried to use java.util.zip.ZipFile I didn�t find way to do that, so if anybody have a way to do that please tell me as fast as possible
Thank you,
Best regards,
Nageh M. El Gendy

You can't "edit" zip files. You have to re-create the ZIP to contain the entries you want.

Similar Messages

  • Sending Downsized Images to Zip File Problems

    I use Adobe Elements 5.0 and have been uploading images to the organizer for a couple of years without problems, until just recently.  Here is how the process used to work.  When images are uploaded they are saved to a new file folder under C drive/ Public Photos/ specific folder with date and subject matter;  I fix the images in adobe then go to the specific folder and create a subfolder within that folder called "downsized".  I then use Adobe to "process multiple files" and downsize for purposes of sending to Pbase. Once the files have been downsized the images end up in the specifc folder, inside the downsized subfolder.  I then rt click and select "send to" 'compressed (zip) folder'.  From there I would open Pbase and upload the zipped folder to a new gallery.
    Recently everything has been fine until I get to the send to zip folder.  Instead of sending to the familiar yellow zip folder it is being sent to the adobe photoshop editor in the form of the adobe icon.  I click on that and it promts me for filename, width, height, resolution and color mode.  I am unable to upload this zipped file version to Pbase.  Previously, when things were operating correctly, I would have a folder, with a subfolder under that called downsized.  Within the downsized folder would be the zipped file for sending to Pbase.  Something has happened recently so that I am ending up with a folder, a subfolder called downsized a sub 'folder' under that which is the adobe elements icon and a downsized file under that which is a copy of the downzied photos in the first downsized file.  In checking out all of my 100 or so folders all of them have been 'converted" to the same organization pattern.  What has happened and how do I fix the problem so that I can send the downsized folder to a zip file for importing to Pbase?  Thank you. 

    You should realize I am just making wild guesses at your problem. And I am assuming you actually have a Microsoft Word document that you are sending. If you do, then following menu options "Insert, Picture, From File..." should work. But if you are just writing out HTML and telling the browser it's actually a Word document, I have no idea.

  • Downloading zip files - problem

    I have a program which is supposed to allow download of a zip file to the users PC and then write a record to a database showing that the user has downloaded the file.
    When I try and read the file I have downloaded I get an error message which says the zip file is incomplete.
    Here is the code which downloads the file
    docname = material.getFilelocation().substring(slashpos+1,material.getFilelocation().length());
    // reformat file name to work with getRealPath
    material.setFilelocation(dirname+"\\" +docname);
    //read data from file
    sc= getServletContext();
    String fileaddress = sc.getRealPath(material.getFilelocation());
    File resfile = new File(fileaddress);
    FileInputStream fileIn = new FileInputStream (resfile);
    BufferedInputStream in = new BufferedInputStream(new DataInputStream(fileIn));
    // Set up output to client
    res.setContentType("application/zip");
    res.addHeader("Content-Disposition", "inline;filename="+docname);
    OutputStream ds=res.getOutputStream();
    byte b[]=new byte[1024];
    int len =0;
    while ((len=in.read(b))>0) {
    ds.write(b,0,len);
    in.close();
    getfilelocation has format -directory/filename.zip
    Does anyone know why the file is incomplete?
    Thanks
    Suzan

    while ((len=in.read(b))>0) {There you are. You stop reading the input when you
    reach the first zero byte. The documentation for this
    method says
    "If no byte is available because the end of the
    stream has been reached, the value -1 is returned."I doubt that's the problem. The API does say that -1 is returned on EOF, but if it isn't going to return -1, then it will read at least 1 byte, stuff that into the array, and return the number of bytes read - which won't be zero unless the size of the array passed to it is zero (which it isn't).

  • PHP 5.0.4, php apps and zip file problems

    I use various opensource web apps that allow for files to be uploaded in zip format. The app then unzips the files and does what it needs to do with them. ie: Gallery2 uploading photos that are zipped up and placing the enclosed photos into the gallery.
    Anyway, this was working very well with the base install of OS X Server's PHP4.? and Apache 1.4.3
    I upgraded to PHP 5.0.4 using Entropy PHP (recommended by another OS X Server admin). Anyway, I lost the ability to handle the zip files. I am unsure what to look for.
    phpinfo() shows the following about compressed files:
    Configure Command
    './configure' '--prefix=/usr/local/php5' '--with-config-file-path=/usr/local/php5/lib' '--with-apxs' '--with-iconv' '--with-openssl=/usr' '--with-zlib=/usr' '--with-mysql=/Users/marc/svn/entropy/php-module/src/mysql-standard-*' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-libxml-dir=/usr/local/php5' '--with-xsl=/usr/local/php5' '--with-pdflib=/usr/local/php5' '--with-pgsql=/Users/marc/svn/entropy/php-module/build/postgresql-build' '--with-gd' '--with-jpeg-dir=/usr/local/php5' '--with-png-dir=/usr/local/php5' '--with-zlib-dir=/usr' '--with-freetype-dir=/usr/local/php5' '--with-t1lib=/usr/local/php5' '--with-imap=../imap-2002d' '--with-imap-ssl=/usr' '--with-gettext=/usr/local/php5' '--with-ming=/Users/marc/svn/entropy/php-module/build/ming-build' '--with-ldap' '--with-mime-magic=/usr/local/php5/etc/magic.mime' '--with-iodbc=/usr' '--with-xmlrpc' '--with-expat-dir=/usr/local/php5' '--with-iconv-dir=/usr' '--with-curl=/usr/local/php5' '--enable-exif' '--enable-wddx' '--enable-soap' '--enable-sqlite-utf8' '--enable-ftp' '--enable-sockets' '--enable-dbx' '--enable-dbase' '--enable-mbstring' '--enable-calendar' '--with-bz2=/usr' '--with-mcrypt=/usr/local/php5' '--with-mhash=/usr/local/php5' '--with-mssql=/usr/local/php5' '--with-fbsql=/Users/marc/svn/entropy/php-module/build/frontbase-build/Library/ FrontBase' '--enable-openbase_module'
    Registered PHP Streams
    php, file, http, ftp, compress.bzip2, compress.zlib, https, ftps
    BZip2 Support Enabled
    BZip2 Version 1.0.2, 30-Dec-2001

    I wish I could be as optimistic about your configuration, you have/had more than two issues, even after building a PHP that would work for you it had to be reconfigured to obtain optimal performance.
    I noticed other errors in your logs but since they weren't specifically related to your issue with zip or PHP running properly I place a low priority on them and ignored them.
    I eventually found the build issue with the entrophy PHP however Mark wasn't interested in the fix since it basically performed the majority of the tasks that were expected and everything else was considered experimental with no real support provided.
    You did get a better PHP built in the ADE (Apple Developer Environment) targeted specifically for your CPU (although they are universal binaries) and I included some modules I wrote myself that provide some (IMHO) key functionality for a production web service like scanning uploaded files for viruses and the ability to generate RRDTool graphs natively without slowing the process down by having to rely on external resources.
    While I have thoroughly tested the modules I wrote, I have not had the time (or the help) to write proper documentation for them so I might later provide some sample PHP scripts since they are fairly simple to implement.
    The biggest problem I saw was that you had a lot of nice toys but none of them were designed to work smoothly together and the entrophy PHP is a good alternative for someone who needs more than what apple provides but isn't capable of generating something that integrates well in the environment.
    Also to note, the entrophy (or Server Logistics) PHP is an all-purpose/general-purpose solution and isn't ever going to be optimal for any specific architecture due to the build process which is why the one I provided works significantly better, it was built specifically for both architectures individually then combined into a single binary giving you the ultimate performer for either architecture without sacraficing performance or degrading functionality.
    I tend to use as much Apple provided software as I can since it makes no sense to me to build and install any software that is already available and built specifically for the environment other than to waste disk space, freetype is a good example, any that is provided will never include the same features and functionality as the apple provided installation yet all PHP makers seem to build the basic bare-bones freetype and build their PHP off of it expecting to achieve the same feature-rich functionality which it clearly isn't capable of.
    They also include a lot of features which are never used and I have removed and/or substituted some of these in an attempt to provide a more usefull set of features and functionality and I include a very complete pear installation which also contains just about every feature and functionality you would ever require without providing anything that that would be considered fluff.
    I've been watching the performance of the installation for a couple of days now and I'm more than satified that it's a solid performer for you so smile and enjoy, santa was nice to you this year.

  • BT cloud zipped files problem

    Hiya there
    I have encountered a really strange problem on my BT cloud storage I first noticed it after zipping some pictures on my computer and uploading the zipped file, then trying to share them, I get this message.
    Now I know for a fact nothing is DRM protected, I uploaded a few images by themselves (without zipping) and was able to obtain a link to share, but as soon as I zipped the SAME pictures I got the message above ?   Now this only seems to affect my zipped images and not say a zipped .exe file.
    Does anyone have any clues as to why I cannot share zipped pictures .. note they are all mine, taken my me, zipped by me and none have any DRM attributes (as proved when uploaded as a single unzipped file)
    Looking forward to any hints as to why this may be
    Z
    Solved!
    Go to Solution.

    ZooBurner wrote:
    Hiya there
    thanks for your reply, I have suspected something like you suggested but i don't find any of the properties you suggest under the security tab..that being said I dont realy understand the way Windows 7 security permissions work at all.  I was using a standard account so i logged onto the admin account zipped the files and uploaded, same result though.
    I have succesfully shared the file via uploading it to my webspace and dropbox both were very easy and worked well, so if it is a  permissions thing then its not a universally applied or enforced one !!
    I do thank you for your time though and will continue to work on this one, I'm wondering if it is a permission that is applied at the BT Cloud end ?
    PS I have also succesfully shared the same file via Onedrive and Googledrive !!
    Many thanks
    Z
    This may help the situation and lead towards a solution:-
    The problem may well lie with the BT Cloud software. It could be just a quirk with FSecure.
    The attribute"wmpnetworksvc"  I had mentioned is not there in the security properties of the .zip file, and must be added.
    If you view the file listing in "My Pictures" folder, or wherever it's held, then select the option "Share With" and then progress to "everyone". Then that attribute is added to your .zip file.
    You will note that if you check the properties of a normal .jpeg file that the atttribute "WMPNetworkSvc" is already there, (as a read only file).

  • Extarct Zip file problem

    hai,
          i am facing issues with extracting epub filesihave used nochump library to extarct this file , but for some files the following error comes
    Error: dynamic block code description: code lengths codes incomplete
        at nochump.util.zip::Inflater/constructDynamicTables();
    i dont know what the problem is?
    Is there any other libarary to extarct zip files???
    please help

    You might like to consider whether this application addresses some of your needs concerning .zip files: http://www.windowsphone.com/en-gb/store/app/pocket-file-manager/56dd9c3d-fe0a-4ceb-84b0-043e58e55b19
    Happy to have helped forum in a small way with a Support Ratio = 37.0

  • Informatica Powercenter 9.01 V26112-01_1of2 zip file problem

    Hi
    I have installed all three informatica zip files but Unfortunately V26112-01_1of2 zip file which contains License Key file and client doesnt work.
    it looks like corrupted. I have dowloaded three times but winzip, rar doesnt work with that zip file
    What can I do?
    thanks
    John
    BTW I am getting
    ! C:\Users\GoK\Desktop\Infa90\901HF2_Client_Installer_win32-x86_DOCS_KEY.z01: Cannot open C:\Users\GoK\Desktop\Infa90\901HF2_Client_Installer_win32-x86_DOCS_KEY.z01
    The system cannot find the file specified.
    ! Seek error in the file
    The system cannot find the file specified.
    Edited by: 877721 on Aug 6, 2011 2:13 PM

    Here is what readme says from Oracle..
    The parts titled "Oracle Business Intelligence Data Warehouse Administration Console 11g and Informatica PowerCenter and PowerConnect Adapters 9.0.1" and  “Oracle Business Intelligence Data Warehouse Administration Console 11g and Informatica PowerCenter andPowerConnect Adapters 9.1" include the Oracle Business Intelligence Data Warehouse Administration Console (DAC) 11g, Informatica PowerCenter Services and InformaticaPowerCenter Client Tools installers, the Informatica PowerCenter License Key and the InformaticaDocumentation.
    These parts are split into multiple downloads. Download all parts into the same directory location on a Windows machine.
    To extract the contents of the zip files:
    1.      Using WinZip, unzip the contents of each downloaded zip file into a single directory location. Do not give this directory a long name and avoid using the My Documents folder. On extraction of all the zip files, you will received additional zip files with file names similar to “dac_win_11g_infa_<OS and Bit>_<INFA version> and with file extensions .zip, .z01, .z02, .z03 etc.
    2.      Using WinZip, unzip the file with the .zip extension file into a new directory. Do not give this directory a long name and avoid using the My Documents folder. NOTE: Do not unzip the .z01, .z02 etc. files as the contents of these files will automatically be extracted.
    On extract of the zip files you will receive the following five files:
    1.     <INFA version>_Server_Installer_<OS> (.tar or .zip)
    2.      DAC11gInstaller.zip
    3.      910HF2_Client_Installer_win32-x86.zip
    4.      Infa91Docs.zip
    5.      Oracle_All_OS_Prod.key

  • ZIP file problem!!!

    Can a ZipFile object be created for a resource known by a URL??? If so how??? if a direct constructor initialisation by URL is not supported(as far as i saw in the API), is there some other means???

    JavaNovicer wrote:
    Dude, kindly dont draw conclusions based on wat u feel... anyways, i know a zip file can be downloaded using url and then it can be unzipped to a suitable location on the system... but i cant to afford to take so much time in following this sequntial approach... coz unzipping using normal java functions takes lots of time.. add to it the time for downloading and the result is a wastage of so much time esp considering the fact the zip file is abt 500 mb... i want to do the unzipping and downloadin concurrently n I JUST NEED TO KNOW HOW TO CREATE ZIPFILE OBJECT FROM THE URL... I DONT EXPECT TO B GIVEN A READY MADE CODE... if ya cant provide any decent help regarding this, fine jus say that.. thats all..What do you consider "decent help" ? The approach I outlined will allow the unzipping and downloading to be done concurrently.
    What do you define as a "ZIPFILE OBJECT" ? The approach I outlined will expand the zip file into it's constituent parts. Since your file is 500MB long the last thing you want to do is try to keep the zip file in memory so you need to either write ti out to a file OR expand the parts sequentially and write them out to a file.
    500 MBytes is a big file and will probably take a long time to download.
    JavaNovicer wrote:
    Also jus to make things clear, i have already implemented the approach u suggested and it does take long time for executionThen you have fukced up the implementation because, unless you have a Gigabyte network, I would expect it to take only a fraction longer than downloading the file. Since you have not shown any code we cannot give any real help.
    Since you obviously don't appreciate my help I will say goodbye.
    .

  • Informatica Powercenter client 9.0.1 V26112-01_1of2 zip file problem

    Hi,
    https://cn.forums.oracle.com/forums/thread.jspa?messageID=9784283&tstart=0
    i followed the above otn url, but i am getting same problem.
    i installed latest version of winzip , winrar and 7zip all are giving same error.
    i followed Readme in edelivery that is also not resolved my problem.
    can any body give me clear picture i.e which zip version i can use and please give me the step by step information.
    thanks
    charan

    can you please help
    do we need to download 3 files for informatica 9 on windows7 64bit?
    Informatica PowerCenter and PowerConnect Adapters Client 9.0.1 (Part 1 of 2)
    Informatica PowerCenter and PowerConnect Adapters Client 9.0.1 (Part 2 of 2)
    Informatica PowerCenter and PowerConnect Adapters 9.0.1 for Windows x86 (64-bit).
    can someone please guide me to step by step installation guide;
    installed server from (Informatica PowerCenter and PowerConnect Adapters 9.0.1 for Windows x86 (64-bit).) file
    not sure if we have to install other 2 client files
    please help
    Thanks in Advance

  • Problem downloading ZIP file with Squid-3.0

    Hi,
    I have upgraded my Linux CentOS squid proxy servers to Squid version 3.0. Since then I can not download the following file it just hangs :
    http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-1.5.5.59.69.zip
    I dont see any error in the squid logs or on my firewall.
    I can however download it on one of the older servers still running Squid version 2.6.
    It is just very strange as I can download ZIP files from any other website with the upgraded servers.
    Any ideas on what might cause this ?
    Thanks
    JHEFER
    Edited by: jhefer on Nov 19, 2009 12:15 AM

    If you have already interested, I found the solution. The problem is that oracle website (and probably others) uses “Vary” field in the header and squid doesn’t support this (by default). You have to download squid sources on http://www.squid-cache.org/Versions/ and compile these with “--enable-http-violations” parameter :
    *./configure ‘--enable-http-violations’ ‘…’ ‘…’*
    make all
    make install
    I hope this solution will be very useful to you.
    Laurent

  • I can't update Fiefox since update 10.o1 or 10.02. Every time I try to I get the same message, "7 - ZIP File is missing" I don't know how or where to correct this problem. I'd really appreciate any help that corrects this problem. Thanks sovery much,

    Missing "7-Zip File"
    Hello,
    I haven't been able to update Firefox since 10.01 or 10.02 because every time I try I get the same message the "7-ZIP File" is missing. Then the update fails. I've submitted this problem to Mozilla Firefox and, got an immediate reply of " they are researching your problem".
    Well, you can tell how long that has been. Is there anything I can do, or any where I can go to get the file I need?
    Any constructive help would be very much appreciated! I'm not sure If I'll ever be able to find where this is located. But I do appreciate help just the same.

    It is possible that your anti-virus software is corrupting the downloaded files or otherwise interfering with downloading files by Firefox.<br />
    Disable your anti-virus software temporarily to see if that makes installing work.
    Download a fresh Firefox copy and save the file to the desktop.
    *Firefox 11.0.x: http://www.mozilla.org/en-US/firefox/all.html
    Uninstall your current Firefox version, if possible.
    *Do NOT remove personal data when you uninstall the current version or you lose your bookmarks and other data because all profile folders will be removed.
    Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
    *It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    *http://kb.mozillazine.org/Uninstalling_Firefox
    Your bookmarks and other profile data are stored elsewhere in the Firefox Profile Folder and won't be affected by a reinstall, but make sure that you do not select to remove personal data if you uninstall Firefox.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *http://kb.mozillazine.org/Profile_backup
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

  • Problem on windows xp with downloaded zip file

    Hi,
    I have written a JSP to download file which is as follows
    try
    response.setContentType("application/download");
    response.setHeader("Content-Disposition","attachment;filename=<FileName>");
    int iRead;
    FileInputStream stream = null;
    try
    File f = new File(<FilePath>);
    stream = new FileInputStream(f);
    while ((iRead = stream.read()) != -1)
    out.write(iRead);
    out.flush();
    finally
    if (stream != null)
    stream.close();
    catch(Exception e)
    //out.println("Exception : "+e);
    After downloading zip file, could not extract files on windows XP by using any tool or built-in extractor i.e. compressed(zipped)folders (error: compressed folder invalid or corrupted).
    But this works on win2k or win98
    How can i work with it or can anyone tell me a solution to handle such a problem.
    Thanks in advance.
    Rajesh
    [email protected]

    This could be a problem with the built-in ZIP program in Win XP - it's possible that the ZIP you are downloading (uploading?) is simply incompatible with the XP program. In Win 98 & 2000, you would have to use your own ZIP program, e.g. Winzip, and that can handle more formats that the XP program.
    Try installing the same ZIP program that you have on w98/2k on your XP machine, and see if you can open the uploaded file using it.

  • Problem with Java and Zip Files

    Hello there everyone. I have a problem with trying to zip up directories with empty folders in them. They zip fine with my code, but according to winzip, the number of files in the archive is incorrect. It's supposed to have a total of 288 files in it, but when it's zipped up, it only says 284. I mention specifically the "empty directories" note because the zipping works fine without empty folders.
    Below is the code for the zip method:
    public static void zip(File[] list, File zipfile, File zipRoot)
         throws IOException {
          if (!zipfile.exists()) {
                   zipfile.createNewFile();
              else if (!zipfile.isFile()) {
                   throw new IOException("The zip file, " + zipfile.getAbsolutePath()
                             + " is not a file.");
              if (list.length == 0) {
                  LOG.error("The list of files to zip up is empty.");
              for (int i = 0; i < list.length; i++) {
                   if (!list.exists()) {
                        throw new IOException("The file or directory, " + list[i].getAbsolutePath()
                                  + " does not exist.");
              FileOutputStream fos = new FileOutputStream(zipfile);
              ZipOutputStream zos = new ZipOutputStream(fos);
              for (int i = 0; i < list.length; i++) {
                   if (LOG.isDebugEnabled())
                        LOG.debug(i + ": " + list[i].getName());
                   String entryName = getRelativeName(list[i], zipRoot);
                   if (list[i].isDirectory()){
                        if (list[i].listFiles().length == 0){
                             ZipEntry entry = new ZipEntry(entryName + "/");
                             zos.putNextEntry(entry);
                   else {
                        ZipEntry ze = new ZipEntry(entryName);
                        zos.putNextEntry(ze);
                        byte[] buffer = new byte[8096];
                        FileInputStream fis = new FileInputStream(list[i]);
                        int read = 0;
                        read = fis.read(buffer);
                        if (LOG.isDebugEnabled())
                        LOG.debug("\tFound " + read + " bytes.");
                        if (read == -1){
                             //empty file, but add it for preservation.
                             //zos.write(buffer,0,0);
                        while (read != -1) {
                             zos.write(buffer, 0, read);
                             read = fis.read(buffer);
                        fis.close();
                        zos.closeEntry();
              zos.close();
    The files look like they're there, but I need the system to be able to determine the number correctly. 
    Here's the interesting thing:  It zips the files, and then when I use the size() method for zip files in java, it says 284 files.  But when I unzip, it says 288 again.  It's like there's files missing when compressed, but when decompressed, they return.  Note that the files are actually there.  If I open the archive in a third party app such as Winzip AND Winrar AND IZarc, they all show 288 files.  Any idea what would make the number of files appear incorrectly in a zip file when zipped by java with the code above?  Thanks in advance.
    - Chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I figured out the problem. When zipping files in windows using winzip, it doesn't explicitly count folders as a "file/folder" as a file in itself. It will create the folders for files to go in, but the folder itself will not be 'counted' when you query the info of the file itself. You have more control of the zip file in java, and can count the folder as a file or not.

  • Zip file as a SOAP attachment problem

    I have an application that sends a zip file as an attachment. I have the file stored on the server and before I send it, I delete and/or add some files in the archive. I use the zip util packages for the zip file editing. I encode it to base64 and then send it as an attachment using SAAJ.
    On the receiving end, I decode it and write it out to disk. Winzip opens the file ok, but when I try to open individual files I get either corrupted data or wrong crc errors. Some files open ok.
    For debugging right before I encode and send it, I write it out to a temp file. Using Winzip, I can open and access any file ok. When I compare this temp file with the response version, they match up. The file properties (size, compressed size, crc) match for those files I can't open.
    I use the com.sun.mail.util.BASE64EncoderStream and com.sun.mail.util.BASE64DecoderStream classes for the base64 operations.
    The errors are:
    1) Warning: the size of the extracted file (570) does not match the uncompressed size (63) recorded in the zip file
    or
    2) Error: invalid compressed data to inflate
    Any help would be greatly appreciated, or general advice for sending zips as SOAP attachments.

    Would you mind, can u send the code pls...

  • Problem with compressing unicode file names in zip file

    Hi Everyone,
    I have a problem while compressing the unicode file name in a zip file. I used the below code for compressing the unicode files.
    String[] source = null;
    // C:\\TestData\\unicode_filename.txt :  unicode_filename.txt is the file created in japanesse language
    source = new String[] {"C:\\TestData\\temp_properties.xml","C:\\TestData\\unicode_filename.txt" };
    byte[] buf = new byte[1024];
    // Create the ZIP file
    String target = "C:\\TestData\\target.zip";
    ZipOutputStream out = new ZipOutputStream(new FileOutputStream(target));
    // Compress the files
    for (int i = 0; i < source.length; i++)
         FileInputStream in = new FileInputStream(source);
         // Add ZIP entry to output stream.
         String fileName;
         File tempFile;
         ZipEntry zipEntry = new ZipEntry(source[i]);
         fileName = zipEntry.getName();
    zipEntry = new ZipEntry(fileName);
    zipEntry.setMethod(ZipEntry.DEFLATED);
    getUTF8Bytes(source[i]);
    // here I'm unable to find the unicode files and not able to understand.
    out.putNextEntry(zipEntry);
    // 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();Please help me how to fix this issue.
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    Thanks for your time for looking into my query.
    Please check the below code for debugging the issue and throw your comments/suggestions for fixing the issue.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    public class ZipTest
      public static void main(String[] args) {
              String[] source = new String[] {"C:\\TestData\\APP_Properties.xml","C:\\TestData\\??.txt" };
              byte[] buf = new byte[1024];
              try {
                   // Create the ZIP file
                   String target = "C:\\TestData\\target.zip";
                   ZipOutputStream out = new ZipOutputStream(new FileOutputStream(target));
                   // Compress the files
                   for (int i = 0; i < source.length; i++) {
                        FileInputStream in = new FileInputStream(source);
                        // Add ZIP entry to output stream.
                        String fileName;
                        File tempFile;
                        ZipEntry zipEntry = new ZipEntry(source[i]);
                        fileName = zipEntry.getName();
                        zipEntry = new ZipEntry(fileName);
                        zipEntry.setMethod(ZipEntry.DEFLATED);
                        getUTF8Bytes(source[i]);
                        out.putNextEntry(zipEntry);
                        // 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();
         private static byte[] getUTF8Bytes(String s) {
              char[] c = s.toCharArray();
              FileOutputStream file;
              try {
                   file = new FileOutputStream("C:\\TestData\\output.txt", true);
                   int len = c.length;
                   // Count the number of encoded bytes...
                   int count = 0;
                   for (int i = 0; i < len; i++) {
                        int ch = c[i];
                        if (ch <= 0x7f) {
                             count++;
                        } else if (ch <= 0x7ff) {
                             count += 2;
                        } else {
                             count += 3;
                   // Now return the encoded bytes...
                   byte[] b = new byte[count];
                   int off = 0;
                   for (int i = 0; i < len; i++) {
                        int ch = c[i];
                        if (ch <= 0x7f) {
                             b[off++] = (byte) ch;
                             file.write((byte) ch);
                        } else if (ch <= 0x7ff) {
                             b[off++] = (byte) ((ch >> 6) | 0xc0);
                             file.write((byte) ((ch >> 6) | 0xc0));
                             b[off++] = (byte) ((ch & 0x3f) | 0x80);
                             file.write((byte) ((ch & 0x3f) | 0x80));
                        } else {
                             b[off++] = (byte) ((ch >> 12) | 0xe0);
                             file.write((byte) ((ch >> 12) | 0xe0));
                             b[off++] = (byte) (((ch >> 6) & 0x3f) | 0x80);
                             file.write((byte) (((ch >> 6) & 0x3f) | 0x80));
                             b[off++] = (byte) ((ch & 0x3f) | 0x80);
                             file.write((byte) ((ch & 0x3f) | 0x80));
                   file.write((byte) '\n');
                   file.write((byte) '\r');
                   file.flush();
                   file.close();
                   return b;
              } catch (FileNotFoundException e1) {
                   e1.printStackTrace();
              } catch (IOException e1) {
                   e1.printStackTrace();
              return null;
    }Thanks
    Aravind                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Why do colors look different in PDF saved from Powerpoint with glow?

    When I save a Microsoft Powerpoint (2008 for Mac) Presentation as PDF, then view the PDF with Preview (application on Mac) it looks right. But when I view it with Adobe Reader, the color is off (it looks dim like there is a gray screen over it) on an

  • Suspect faulty hardware in HP DV4-1548dx, what does it take to convince HP?

    I purchased this laptop for my elderly mother.  She is not tech savvy enough to interact with HP on her own to resolve issues.  I am very tech savvy and design computer systems for a living.   She told me that the laptop has occasionally not been sta

  • I have just plugged my phone into mac

    Iphoto will not load my photos - it shows my device on the side but no photos  what can I do to import the photos from my phone onto the mac.  Thank you

  • N70 update gone wrong

    Ok well my Nokia N70 kept freezing and when I searched this on google it came up with a link to the Nokia site for a firmware update. I did this, followed the instructions and was just about to complete the update when I knocked the usb cable with my

  • Scanner stop scanning

    I have an HP Officejet J6450 All-in-One Printer installed in Mac Os x, Mac Book 3.1 The printer works but the scan start scanning but stop and show a message that said" an unexpected error occur" If there is a solution?