How to uncompress zip files using java program

hai,
please give some sample code to decompress the zip file.
how to uncompress zip files using java program
thanking you
arivarasu

http://developer.java.sun.com/developer/technicalArticles/Programming/PerfTuning/
Scroll down to 'Compression'

Similar Messages

  • How can I trasfer file using java program (from NT to Unix)

    Hi all,
    I want to transfer a text file from Windows NT to Unix machine inside the Java program.
    How should i do it.
    Thanks in advance.
    Regards
    Rajeev

    you have several options:
    - make your system administrator software install software on Unix and NT so that you can see a directory on the Unix machine from your NT machine, and just copy the file there
    - use FTP to put the file on the Unix machine
    Jesper

  • Updation in zip file through java program

    Hi,
    Can any buddy help me updating zip file using java programs. I dont want to delete the zip file but I want to update single file in the zip.
    Any clue ?
    Regards,
    Ashish

    I mean I want to update a zip file using java program.
    Suppose there are 4 files zipped into single zip file.
    zipped.zip contains a.txt, b.txt. c.txt. d.txt
    Now the contect of a.txt got changed and I want to update zipped.zip to with the changed a.txt.
    I have one way of creating a new file with new set of a.txt, b.txt, c.txt and then delete the earliar zipped.zip and rename the newly created zipped to zipped.zip.
    I dont want to do the same as above mentioned way. Is there any way provided in java API to remove any entry or update any entry?
    I feel now the problem has got explained in details.
    Any help ?

  • Zip and extract multiple files using java program

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

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

  • How to check & unzip zip file using java

    Dear friends
    How to check & unzip zip file using java, I have some files which are pkzip or some other zip I want to find out the type of ZIp & then I want to unzip these files, pls guide me
    thanks

    How to check & unzip zip file using java, I have
    ve some files which are pkzip or some other zip I
    want to find out the type of ZIp & then I want to
    unzip these files, pls guide meWhat do you mean "other zip"? Either they're zip archives or not, there are no different types.

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

  • How to read system eventlog using java program in windows?

    How to read system eventlog using java program in windows?
    is there any java class available to do this ? or any one having sample code for this?
    Your friend Zoe

    Hi,
    There is no java class for reading event log in windows, so we can do one thing we can use windows system 32 VBS script to read the system log .
    The output of this command can be read using java program....
    we can use java exec for executing this system32 vbs script.
    use the below program and pass the command "eventquery"
    plz refer cscript,wscript
    import java.io.*;
    public class CmdExec {
    public static void main(String argv[]) {
    try {
    String line;
    Process p = Runtime.getRuntime().exec("Command");
    BufferedReader input =
    new BufferedReader
    (new InputStreamReader(p.getInputStream()));
    while ((line = input.readLine()) != null) {
    System.out.println(line);
    input.close();
    catch (Exception err) {
    err.printStackTrace();
    This sample program will list all the system log information....
    Zoe

  • How to read system evenlog using java program in windows

    How to read system evenlog using java program in windows???
    is there any java class available to do this ? or any one having sample code for this?
    Your friend Zoe

    Welcome to the Sun forums.
    >
    How to read system evenlog using java program in windows???>
    JNI. (No.)
    >
    is there any java class available to do this ? or any one having sample code for this?>You will generally get better help around here if you read the documentation, try some sample code and come back with a specific question (hopefully with an SSCCE included).
    >
    Your friend Zoe>(raised eyebrow) Thank you for sharing that with us.
    Note also that one '?' denotes a question, while 2 or more generally denotes a dweeb.

  • How to run .jar on linux & how to create .jar file using java?

    hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
    thanks in advance.

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • How to print PDF files using java print API

    Hi,
    I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api.
    Thanks in advance

    Mike,
    Can't seem to get hold of the example described in your reply below. If you could let us have the URL to get then it would be great.
    My GUI application creates a pdf document which I need to print. I want to achieve this using the standard Java class PrinterJob (no 3rd party APIs I'm afraid, commercial restraints etc ..). I had a stab at it using the following code. When executed I get the pretty printer dialog then when I click ok to print, nothing happens!
    boolean showPrintDialog=true;
    PrinterJob printJob = PrinterJob.getPrinterJob ();
    printJob.setJobName ("Contract.pdf");
    try {
    if (showPrintDialog) {
    if (printJob.printDialog()) {
    printJob.print();
    else
    printJob.print ();
    } catch (Exception PrintException) {
                   PrintException.printStackTrace();
    Thank you and a happy new year.
    Cheers,
    Chris

  • How to open/read file using Java in Unix?

    Hi Friends,
    Can you please help me out how to open/read file using java in unix os? I have create one text file in "/home/test.txt" in unix environment. How to open the same file & read using java code?
    - Hiren Modi

    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • How can zip file using java ?

    I would like to ask is that any package or example code allowing zipping serveral file using java ?

    Here's a test program I wrote, which may help. As far as I know the jip/zar classes are interchangeable.
    import java.io.*;
    import java.util.jar.*;
    public class ZipTest
        public static void main(String[] args) throws Exception
            /* create a file stream for the new zip file */
            FileOutputStream fileOutputStream=new FileOutputStream("test.zip");
            JarOutputStream zipOutputStream=new JarOutputStream(fileOutputStream);
            /* open file to add to zip file */
            File file=new File("test.dat");
            FileInputStream fileInputStream=new FileInputStream(file);
            /* create a buffer and read file into buffer */
            int length=(int)file.length();
            byte[] buffer=new byte[length];
            fileInputStream.read(buffer,0,length);
            /* create entry in zip file */
            JarEntry jarEntry=new JarEntry("test.dat");
            /* add it */
            zipOutputStream.putNextEntry(jarEntry);
            zipOutputStream.write(buffer,0,length);
            /* clean up and exit */
            fileInputStream.close();
            zipOutputStream.close();
    }

  • How to gzip a file using java

    Friends,
    I want to gzip a file in unix using my java program, can I use Runtime.exec() method and run the gzip command to achieve this ?
    Is there any other way to zip/compress a file using java api ?
    Thanks

    Use [url http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/GZIPOutputStream.html]java.util.zip.GZIPOutputStream along with [url http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileOutputStream.html]java.io.FileOutputStream

  • How to Call .XDO file From Java Program

    Hi,
    I have developed a report in using BI Publisher version 10.1.3.
    I created the report and it only created XDO files. If I want to call XDO file from Java program how I can do that.
    What are the APIs available to do that.
    Thanks
    -Ashutosh

    Hi,
    the JavaAPI didn't work with the xdo-Files. But you can create a proxy stub for the Web Service API of BI Publisher which uses the xdo's in the repository.
    regards
    Rainer

  • How to read pdf files using java.io package classes

    Dear All,
    I have a certain requirement that i should read and write PDF files at runtime. With normal java file IO reading is not working. Can any one suggest me how to proceed probably with sample code block
    Thanks in advance.

    hi I also have the pbm. to read pdf file using JAVA
    can any body help meWhy is it so difficult to read the thread you posted in? They say: java.io is pointless, use iText. So why don't you?
    or also I want to read a binary encoded data into
    ascii,
    can anybody give me a hint how to do it.Depends on what you mean with "binary encoding". ASCII's binary encoding, too, basically.

Maybe you are looking for

  • Web sharing not working (Forbidden error)

    http://localhost/~myusername  doesnt work with web sharing turned on. http://192.168.0.102/ (my local IP on the network) also fails to work. It won't open locally or from other computers on the network. I tried the apple fix here http://support.apple

  • List of transactions executed in the last one year along with the count

    Hi all, I want to find the list of transactions executed in the last one year in my IDES system. Also, i want to find how many times these transactions got executed in the last one year. I already saw, ST03 and ST03N tcodes. But im not able to see th

  • DTR component not fully functional

    Hi all, We recently tried to change the DTR repository properties file, according to SAP NOTE: 1001509. After performing the process mentioned in this note, we noticed this particular repository.properties file has the wrong content (I downloaded the

  • Working with online accounts

    This question was posted in response to the following article: http://help.adobe.com/en_US/acrobat/using/WSa65464b4e07c3e0a781ee72f1298fed479c-7ffe.html

  • Skype 7.6 (409) Cant connect after sleep/lid-close...

    Skype cannot connect after sleep or after I've closed the lid of the computer. I've tested this out and it sometimes opens up the main skype chat window however I am offline and cannot go online. I've tried several methods; - deleting $TMPDIR/Skype d