Unzipping a gz file that's in a JMS Message

Could anyone please help me figure out how to unzip a message from a JMS Message. I have tried all sorts of things and I just can't get it to work.
Jeremy

Hi I can just help you out how to extract file from
zip format and hope it will help you out and i am
giving you it by showing you one example.
import java.util.*;
import java.io.*;
import java.text.*;
import java.util.zip.*;
public class sandyzip
     public static void main(String[] args)
     {     try{
               Enumeration entries;
               ZipFile zipFile;
               ZipEntry entry =null;
               byte[] buffer = new byte[10000];
               int len;
               InputStream in=null;
               OutputStream zout=null;
zipFile = new
new ZipFile("D:\\JavaPractice\\04-04-2007data.zip");
               System.out.println(zipFile);
               entries = zipFile.entries();
               System.out.println(entries);
while(entries.hasMoreElements()) {
ry = (ZipEntry)entries.nextElement();
               in=zipFile.getInputStream(entry);
zout=new BufferedOutputStream(new
new
FileOutputStream(""+"D:\\JavaPractice\\"+entry.getName
               System.out.println("**************"+entry.getName()
               System.out.println(zout);
               while((len = in.read(buffer)) >= 0)
               zout.write(buffer, 0, len);
               System.out.println("Unzip done");
          catch (Exception ex) {
               ex.printStackTrace();
Hope it will server your purpose.
Cheers
Sandyand where did JMS fit into the equation?

Similar Messages

  • Unzip (a zip file that has pdf files and a csv)

    Here is my requirement:
    Receive a zip file (that contains PDF files and a CSV file) in BizTalk
    Each record in CSV has a field which identifies the PDF files (by pdf file name) associated with it
        For Example - record id on each row in CSV file identifies the pdf files associated with it,
                             pdf files have names starting with recordid_sequence number.pdf i.e. 11111_1.pdf, 11111_2.pdf, 
                             11111_3.pdf...
    Create two new zip files based on record id on the record in CSV file
        For example - one zip file with a new CSV and related pdf files for record id range 1 to 5000
                             another zip file with a new CSV and related pdf filesfor all other record ids
    using BTS2010!!
    "custom flat file disassembler component" or "use .Net helper class/service" or anything else? custom component should be fine to unzip and extract pdf files and read CSV? can go with another custom component on send to perform split
    and zip the files.
    Any recommendations?

    Hi,
    You can built custom pipeline component for unzipping, I have wrote an article for it: http://social.technet.microsoft.com/wiki/contents/articles/20640.biztalk-server-2010-processing-zip-message-having-multiple-type-files.aspx
    Also sample is available : http://code.msdn.microsoft.com/windowsdesktop/BizTalk-Server-2010-42a1ae49/view/SourceCode
    I hope it helps !!
    Maheshkumar S Tiwari|User Page|Blog|BizTalk
    Server : How Map Works on Port Level

  • How can I get rid of files that cannot be imported error message

    Hello, this is my first post. I am a new mac user. I have imported my jpgs from an external hard drive which was in the most part successful, however, 14 of the files appear to be corrupted and every time I open iphoto9, I get the error message, '14 of your files could not be imported, would you like to import them now?' I have tried choosing both options yes and no and it then writes error message telling me it has created recovered photos folder. When you go to this folder it is empty and every time I restart iphoto, I get the same message. I have tried deleting all the files and re-importing only to find that the number of corrupted files has now doubled. I have also deleted the iphotos library recovered photo folders to no avail. I have tried creating a new library and importing the files to that but the same problem occurred. How can I get rid of this repeated error as I am now up to recovered folder number 47! Help!

    P Robbins
    Welcome to the Apple user to user assistance forums
    quit iPhoto and right click (control click) on the iPhoto library (in the pictures folder by default) and select the show package contents command - find the import (or importing) folder and drag it to the desktop and launch iPhoto - you should be fine now - open the import(ing) folder on your desktop and if there are any photos you want import them then trash the folder
    LN

  • How to distinguish the type of object that came in the JMS message.

    I have a queue that has 4 different object's being sent through messages across the queue. Depending on the object that comes in I need to determine what process to start. I have created a master project with a single queue listener that will start the master process. Either before the listener starts the master process or after the master process starts in a method I need to figure out the type of object that was contained in that method. In Java its simply if(msg InstanceOf ObjectB), else if (msg InstanceOf ObjectC)....and so forth. What is the way this would be done in ALBPM6.0's fuego code or whatever it is called?

    In case you had an ID, which is assigned automagically on emp, this could also be written like this:
    create trigger emp_trig
    after insert or update or delete on emp
    for each row
    begin
    insert into emp_log values(
    :new.empno, :new.ename,
    decode(nvl(:old.id,-1),-1,'Insert',decode(nvl(:new.id,-1),-1,'Delete','Update')), sysdate);
    end;
    ..where -1 is a value you do not expect to be propagated ever in id column. Also, :new.empno and :new.enmae will be null if the dml being executed is a delete statement.

  • CFZIP can't unzip FTP'd file

    When I try to unzip a zip file that was FTP'd to my server I
    get an error:
    Ensure that the file is a valid zip file and it is
    accessible. Cause : java.util.zip.ZipException: error in opening
    zip file
    I can open the zip file through windows with no issue so this
    has to do with what CF uses to open the file. I also extracted the
    files in the zip file and then created a new zip file on my own and
    CF can unzip that file fine as well.
    Does ftp'ing a file cause some kind of change with the file
    that would cause the exception?

    jsg1000 wrote:
    > When I try to unzip a zip file that was FTP'd to my
    server I get an error:
    >
    > Ensure that the file is a valid zip file and it is
    accessible. Cause :
    > java.util.zip.ZipException: error in opening zip file
    >
    > I can open the zip file through windows with no issue
    Did you open the exact file that was FTP'd to your server or
    the initial
    file ? FTP files can be transferred in 2 modes: ascii and
    binary there
    is a possibility that the files was transferred in ascii and
    thus corrupted.
    > Does ftp'ing a file cause some kind of change with the
    file that would cause
    > the exception?
    It might be. Read about the ascii/binary mode for a ftp
    transfer for
    more info.
    Mack

  • Unable to unzip the downloaded files

    So that we may better diagnose DOWNLOAD problems, please provide the following information.
    After downloaded the 9i for Windows (disk1,disk2,disk3). I cnnot unzip the file. I get the foloowing message from WinZip message box: "The WinZip Wizard cannot open this file; it does not appear to be a valid archive. If you downloaded this file, try downloading again. If you want to add the file to an archive, first create or open the archive, then drop the file again."
    I downloaded the file again and still get the same message. What do I need to do? Thank you for your help.
    - Server name
    - Filename 92010NT_disk1.zip
    - Date/Time
    - Browser + Version
    - O/S + Version
    - Error Msg

    It is quite easy to solve your problem. Double click your disk1 or anyone of the 3 and right click the zipped folder then click on extract all. Do the same for all the 3 disks. You should find at the end exe file on disk1. Good luck

  • How to read/unzip a specific file within a zip file

    Hi,
    I have a file within a zip file that contains a timestamp - I want to read this timestamp and then create a destination directory for the remaining zip files to be unzipped into. Since I know the name of the file with the timestamp in it I thought I could create a zipfile and use getEntry to get the entry but then other than getting the size and name of the file I can't do much more with it like read it unless I use a stream (zipinputstream) instead of a file (zipfile) - do I have this right?
    Does this mean to get the content I would have to loop through possibly all the files using the stream until I come across the one I want - then get the timestamp and loop through them all again to write them to the destination directory? Or am I reading this wrong - seems a bit round about.
    Any suggestions would be greatly appreciated.
    Thanks

    this works though - and you don't have to loop through all the files - just use the ZipFile:
    ZipEntry ze = zipfile.getEntry("path/to/file");
    BufferedReader br = new BufferedReader(new InputStreamReader(zf.getInputStream(ze)));
    line = br.readLine;Thanks!

  • Want to partly unzip a zip file

    I'm trying to upgrade a BIllion 7404 gateway. The relevant firmware is at the top of the list here:
    http://au.billion.com/support/bipac7404vgpm.php
    If my understanding is correct the zip file for the firmware upgrade contains a file within it, a .afw file, that will upgrade the firmware on the Billion. However, when I double click on the zip file, Stuffit unzips the whole lot and I end up with 29 separate files that make up the .afw file, whereas I need the .afw file intact.
    If I put the zip file, call it Upgrade.zip, onto a disk called G5-Data (the name I have given the internal drive on my G5), and use the Terminal command unzip, can anyone tell me the exact command I would need to type in to get a hold of the unzipped .afw file that resides within the zip file?
    Thanks in advance for an suggestions.

    Hi Cole,
    I don't really understand how I got the file, but I got it. The file that I wanted itself contains 29 files that you are not supposed to see. When it is unzipped on a PC, the unzip process stops at the first layer, and that file is recognizable by the gateway as a firmware upgrade file. But if you give the gateway the folder with the 29 files it doesn't know what it is.
    Stuffit reaches into the second layer and unpacks the lot into a folder of 29 files. Must be something in the zip file that is incorrectly setup that allows Stuffit to do that.
    Anyway, I tried the command I posted and up came one file. I found a program called BetterZip that also unzips the file correctly. Maybe there is something wrong with Stuffit 10 and I should give it the boot. Do you know anything about that?
    Thanks again for your help,
    Guy

  • Problem in Unzipping the zip file

    Hi
    I have created a program to unzip the zip files in the folder named after the zip file
    it is working well well when u try to zip zip files put in a directory
    i.e u create a folder name contents and put files into that and then zip it
    but when u directly create a zip file , without putting in a folder
    it creates the folder and zip the files outside the folder
    Another problem is that with the path
    for e.g. suppose the zip file name is contents and path should show
    contents/filename.txt but there are some other files whose path shows
    res/file.txt. In this case it creates a folder of res and put it outside the
    folder with the name of zip file
    I have pasted my code :
    //Unzip the zip files to the folder with their name
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.FilenameFilter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.Enumeration;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipFile;
    // Getting the path to find the type of files
    public class zipper implements FilenameFilter{
              String ext;
              public zipper(String ext)
                   this.ext="." + ext;
              public boolean accept(File dir,String name)
                   return name.endsWith(ext);
    public static void main(String args[]) throws IOException
              try
                        String dir = "D:/";
                        File f2 = new File(dir);
                        FilenameFilter fn= new zipper("zip");
                        String ss[]=f2.list(fn);
                   for ( int j = 0; j < ss.length; j++)
                        System.out.println(" Extracting ...." + ss[j]) ;
                        String zipFile = dir + ss[j];
                        ZipFile zf = new ZipFile(zipFile);
                        Enumeration entries = zf.entries();
                        String directoryName = zf.getName();
                        directoryName = directoryName.substring(0, (directoryName.indexOf(":" + File.separator) + 2));
                             String folderName = zf.getName();
                             folderName = folderName.substring(0, folderName.lastIndexOf("."));
                             File file1 = new File(folderName);
                             //File file1 = new File(entries.getName());
                             file1.mkdir();
                   while (entries.hasMoreElements())
                             ZipEntry ze = (ZipEntry) entries.nextElement();
                             String path = directoryName + ze.getName() ;
                             String path1 = folderName + ze.getName();
                             //System.out.println(" : " + path);
                             if (ze.getName().endsWith("/"))
                                       File file = new File(path);
                                       file.mkdir();
                                       continue;
                                       //break;
                        BufferedReader bReader = new BufferedReader(new InputStreamReader(zf.getInputStream(ze)));
         StringBuffer fileBuffer = new StringBuffer(" ");
         String line ;
                        while ((line = bReader.readLine()) != null)
                                  fileBuffer.append(line);
                                  fileBuffer.append("\r\n");
                                  //line = line + "\r\n";
                                  //byte[] b = new byte[line.length()];
                                  //b =line.getBytes();
                                  //out.write();
                        String fileData = fileBuffer.toString();
         File f1 = new File(path);
                        f1.createNewFile();
                        //FileOutputStream out = new FileOutputStream(folderName + "/" + ze.getName());
                        FileOutputStream out = new FileOutputStream(path);
                        long size = ze.getSize();
                        byte[] data1 = new byte[fileData.length()];
                        for (int i = 0; i < fileData.length(); i++)
                                  data1[i] = (byte) fileData.charAt(i);
         out.write(data1);
         out.close();
                        bReader.close();                         
                   } catch (Exception e)
                             e.printStackTrace();
    Thanks in Advance
    Avinash

    String path = directoryName + ze.getName();
    String path1 = folderName + File.separator+ ze.getName();
    File f1 = new File(path); // pass path1 instead of path
    f1.createNewFile();
    FileOutputStream out = new FileOutputStream(path); // pass path1 instead of path

  • "Block Files That Cannot Be Scanned" in TMG malware inspection feature didn't work

    hi friends.
    in my TMG test lab, i have enabled malware inspection both Globally & on my web access rule & in its settings i have selected
    "Block Files That Cannot Be Scanned".
     now in my test external website i have a text file which is archiced it via winrar & set a password on it. password is 123.
    now when i connect  to that website, i can download that file & unzip it.
    why TMG didn't block this pasword protected archive ? it must block according to this option : ( "Block Files That Cannot Be Scanned".
    any help ?
    thanks in advance
     

    Hi,
    Thank you for your post here.
    Before going further, we must make sure that we have enabled Malware inspection and we need to note that web protection need license.
    Please follow the steps below to verify if your malware inspection is enabled meanwhile update the latest definitions.
    http://technet.microsoft.com/en-us/library/dd441078.aspx
    Additionally, you could try to check both “Block encrypted files” and “Block Files That Cannot Be Scanned” options to see if it works.
    Best Regards
    Quan Gu 
    hi quan, thanks.
    malware inspection is enabled with evaluation license & is not expired.
    both chek marks are selected but it again doesn't block password-protected rar files. if possible please test that.
    many thanks in advance

  • Unzipping an archive file-permission denied

    Each time I try to unzip (with the system "Archive Utility") a file in an external drive i get an error message. "operation can not be opened, permission denied"
    I have just repaired permissions and verified in my SYS HDD without success.
    Any ideas here?

    Should have defined better...
    I did drag the .zip file from the portable drive to my desktop and looked at permissions in the info window. I am the admin and owner of the file as shown. Tried again to open the .zip file and again the same error message. I then "repaired permissions" throiugh the disk utility and had the same results. This is true for a copy of the file on another drive that i also tried to open. Same error message.
    Other .zip files open fine with the archive utility, its just these two that will not open,

  • Zipping  and Unzipping Directories and files both - URGENT PLEASE

    Hi friend,
    I tried for zipping and unzipping but it is not working still.
    and have to submit project tomorrow.
    so please as possible as fast just send me the source code that zip the file/folder and unzip in the same way as it was stored.
    ex : if we zip file c:/temp/myfolder/myfile.ppt to .zip
    unzip should c:/temp/myfolder/myfile.ppt
    thanks
    ghanshyam
    9879152949

    I believe (although I don't want to put words in his mouth) that Madan has run across a similar problem that I am trying to solve.
    For instance if I have the following files:
    c:\pic1.gif
    c:\pic2.gif
    c:\pic3.gifand I zip them in to a file called: pics.zip the will unzip just fine.
    However, if I have them in a directory:
    c:\pics\pic1.gif
    c:\pics\pic2.gif
    c:\pics\pic3.gifA listing of the zip files (all using java of-course) will show the files and dirs correctly:
    \pics\pic1.gif
      \pics\pic2.gif
      \pics\pic3.gifbut will give the following error if you try to un-zip them:
    "The system cannot find the path specified"The ZipEntry class has an 'isDirectory()' method, but it only returns true in the case of an EMPTY directory. If , as in my example, there is an actual file at the end of the entry, it returns false.
    So, at least in my case, I would be looking for advice on how to expand files that reside in directories within the zip file.
    Thank You for any help you can provide

  • Does anyone know if you can unzip a .cab file in mac osx 10.5.8? The file in question is an Excel spreedsheet template. Thank you...

    Does anyone know if you can unzip a .cab file in Mac OSX 10.5.8? I am trying to open an Excel spreed sheet template that was downloaded as a .cab file from office for mac website... thank you

    Use Stuffit Expander, Download and install from here, make sure you download the correct version for your Mac OS:
    Stuffit Expander Mac

  • Finder doesn't show files that Terminal shows

    Running 10.4.4. I have a zip file that expands into a folder containing many subfolders. Finder tells me that the majority of these folders are empty despite the zip file being several MB in size. Opening some, but not all, of the folders forces Finder to tell me what's really there but this doesn't work for all of the folders. I can go into Terminal and see the contents of every folder. What's going on here? This has never happened before. Repairing permissions didn't fix it. It's also happening with other folders not related to the zip file.

    Here's an update. The zip file in question contains the latest version of a suite of Java applets that I've been using for some time. The developer just sent me the previous version and the latest version, but the latter was compressed with a different compression tool; he didn't say which one. I moved the two zip files onto my iBook G3 running OS X 10.3.8 and they both unzipped correctly. However, under 10.4.4 only the one compressed with the different compression tool unzipped correctly. This suggests a bug in 10.4.x does it not?

  • Help:how to use java.util.jar to zip or unzip a binary file.

    how to use java.util.jar to zip or unzip a binary file or a file contain native code.

    It may help you to know how I add JARs
    1. I open my Project (myProject)
    2. I Mount the JAR to the FileSystem (like mypackages.jar = which includes com.mus.de.myClass.java)
    3. I Mount the File to the FileSystem (like c:\..myfiles..\myProject)
    3.1 I add the File to my Project
    4. I select File | New -> Classes | Main
    4.1 I typed "import com.mus.de.myClass.java" to refer to this package.
    4.2 I called some of the public methods
    thats it
    Andreas

Maybe you are looking for

  • How to export a table from one oracle server to another oracle server?

    Hi experts, Scenario : Copying table T1 from Server1 to Server2. Can I follow any of the following two options. Please advise if these options would be feasible under the current scenario. 1) Create the same table T1 in Server2. Export the values of

  • IPhoto 6 and Photoshop Elements 4.0

    I need some help on deciding which program to buy. I can only afford one or the other right now and I know there are other programs available with iLife but right now I am only interested in the iPhoto part. Can anyone tell me the benefits of one of

  • Help with my iPhone 4, Will they replace?

    I purchased my black, 16GB iPhone 4 on August 4th, 2011. Over the past 5 days it gets really hot around the bumper and on the back and then shuts off. This happens after about 30min to an hour. I've tried restoring over and over still no luck? Do you

  • Function: I get ORA-04063 if I try to execute from another schema

    Hi All, I have a schema named "SCHEMA_A" and in this schema I have a function named TEST" that gets a numeric parameter "ID" and returns a string. Then I have a schema named "SCHEMA_B" with a grant on functions SCHEMA_A.TEST. I want to use function "

  • C99 math functions

    Hello all yet again, I'm trying to use the C99 math functions: nearbyint, round, exp2, cbrt, etc... But they don't seem to be defined in the CVI2013 header file. I previously would compile them (with gcc) only if __STDC_HOSTED__ was defined, but it a