Results 1 to 2 of 2
  1. #1
    kathir0301 is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default How to read filename inside .gz file?

    Hi
    I want to know how to read name of file inside .gz file. im using GZIPInputStream to read .gz file.
    pls help me on this
    Thanks in advance

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    gzip is usually a compression file contents. that is, a gzip on its own does not have any additional headers, so there is no storage of the file name in a plain gzip. we could figure out what the file name was before gzipping it. For example, if the file was called "myfile.sql.gz", we could probably guess the file name by dropping the .gz suffix.

    Now, if the .gz file is a tar file, there is a Java Tar API that can read the tar file contents inside the gzip file, and then get the tar file names of the files stored inside the tar file.

Similar Threads

  1. how we can read inside all of files in a directory
    By cowboy2010 in forum New To Java
    Replies: 9
    Last Post: 08-03-2010, 05:55 PM
  2. how to read the ArrayList inside HashMap
    By koddy in forum New To Java
    Replies: 6
    Last Post: 07-15-2010, 02:41 PM
  3. I can't read a text file located inside my jar.
    By Serrano0811 in forum New To Java
    Replies: 1
    Last Post: 04-21-2010, 06:03 PM
  4. Replies: 4
    Last Post: 04-03-2010, 07:20 PM
  5. Replies: 2
    Last Post: 11-29-2009, 11:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •