Retrieve GZip'ed file name

Hi,
I have to decompress a GZ file. It's easy to read an original file content using java.util.zip.GZIPInputStream, but I can't find a method to obtain an original file name.
Let me explain. Imagine that you have a file "toto.txt". Then you compress it with GZ utility, it give you default name "toto.txtx.gz". And then you rename your archive to "titi.gz".
So, the question is: how to find original "toto.txt" name given "titi.gz" file?
I check a GZ file, information is there (a z-string at 10 bytes offset from the beginning), but I don�t want to read a binary file, I wonder if JavaSoft forgot to create such a useful metod.
Thanks for any help :-)

Just try to rename a GZ file, then extract a content and check a file name :-)
I've look at the sources, apparently original name is an optional information and it's skiped while reading GZ header :
GZIPInputStream.class, line 165
// Skip optional file name
if ((flg & FNAME) == FNAME) {
while (readUByte(in) != 0) ;
Thanks anyway for your answer ;-)

Similar Messages

  • Retrieve path from File Name

    Hello,
    I have a string that contains a full FileName; i.e., The path and the file name.
    How can I get just the path out of that string?
    I tried "File(FileName.path)" but it returned something like "0000 temp"
    Seemingly, that only works on a file object, and not on a string.
    I wanted to do something through find/replace within the string... but I dont know about it.
    In other languages I would do a reverse search on a forward slash - which would find the last slash in the string
    and I would erase everything after that.
    If anyone can help me with this, I will greatly appreciate it!
    Thanks,
    Davey

    Assume a string variable s; then
    myPath = Folder(s).path;
    (if the string s is a legal path) will give you the path associated with s's the full path.
    Peter

  • Retrieve Current Report File Name

    i am using Forms and Reports 6i.
    in Forms, i am using the following statement to get the current form name -
    GET_FORM_PROPERTY (:system.current_form, FILE_NAME)
    i didn't find a similar statement in report to get the report file name,
    plz help...

    Hello,
    You will have more chance to get an answer by sending this question in the Reports forum.
    Francois

  • Need File name in PSE9

    I need to develop some macros to use with PSE9, but for me to do that, I need to retrieve the COMPLETE file name (including path) from PSE9 of the current edited file.
    Does PSE keep this info somewhere where I can get it?

    Actually I mean an external Macro Engine.
    Many programs assign internal variables to the file they are working with, like %filename% or something like that.
    I need to know if PSE9 does such a thing, or if there is any keyboard shortcut that gets me this information.
    Save and Save As will display the current edited file, but NOT the full PATH. I need the full path!
    I am in Editor and not Organizer

  • How to get PDF file name when DESTYPE=CACHE

    Hello.
    I'd like to retrieve the generated file name from the cache directory in the After Report trigger when DESTYPE=CACHE and DESFORMAT=PDF
    Is it possible?
    Thanks
    Rasto Sadecky
    [email protected]

    Thank you Rohit.
    It's not really the caching mechanism I'm interested in.
    What I need to do is a physical modification of the generated PDF file.
    We have done it successfully for DESTYPE=FILE because in this case
    we know the name of the PDF file so the after report trigger can call an external dll library
    that modifies the PDF file.
    But when I'm calling the report from a JSP I can't do the same because
    I don't know the name of the PDF.
    Any ideas?
    Thanks
    Rasto

  • .ttf file name

    hi all, it's possible to retrieve the ttf file name of a font?
    I tryed java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() but I get only the font name...
    Anyone could help me?

    Can't say I'm familiar with GraphViz, but with a little search on the web, it looks to me that they might just want font names, not font file names, and they may use the font name to derive the actual file name.
    http://www.research.att.com/~erg/graphviz/info/attrs.html#a:fontname
    But again, I'm not GraphViz experienced.

  • How to retrieve various file names from a filepath of application server

    Hi All,
    I am using a FILEPATH  of application server which can have multiple file names i want to retrieve data from all the existing files.
    i am using FM "GET_NAME_FILE" but it is applicable only for file name.
    so my question is how to fetch various file names of particular filepath.
    Thanks in advance.

    Hello Mayank,
    You can use the below FM and code
    PARAMETERS: p_file TYPE rlgrap-filename.
    ***AT Selection-Screen*******
    AT SELECTION-SCREEN ON  VALUE-REQUEST FOR p_file.
    ***Function  module for F4 help from Application  server
      CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    * EXPORTING
    *   DIRECTORY              = ' '
    *   FILEMASK               = ' '
       IMPORTING
       serverfile             =  p_file
       EXCEPTIONS
       canceled_by_user       = 1
       OTHERS                 = 2
      IF sy-subrc = 0.
        MESSAGE 'Successful'  type 'I'.
      ENDIF.
    Regards,
    Mithun Shetty

  • Retrieving the file name in the adapter module in the sender file adapter

    hi,
    i need to retrieve the file name, in the adapter module. This module is placed in the sender file channel.
    After the file adapter has picked up the file from the file directory, the file is placed in the archived directory.Custom adapter mofule is place in the file shanel. i need to retrieve the file name of the file in the adapter module. Is it possible to retrieve the file name?
    Also is it possible to retrieve the archive directory path in module?
    Regards,
    Meenkashi

    Hi Meenakshi,
    I guess you are looking for this
    /people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
    Regards
    Suraj

  • Retrieve file name from full file path

    I am trying to retrieve a file name from a path (ex. c:\temp\tes.txt) using the following code, but it is given me an error of "The method split(String) in the type String is not applicable for the arguments (char).
    {code}
    String filepath = item.getName();
    String[] buf = filepath.split('/');
    String filename = buf[buf.length-1];
    {code}
    I tried to use double quote instead of single quote, but it is not returning anything.
    {code}
    String[] buf = filepath.split("/");
    {code}
    Anyone knows why? Thanks.

    How is this related to JDBC?
    Anyway, is the path separator actually a forward slash? Isn't it a backward slash?
    If you're using Apache Commons FileUpload (which I guess, the 'item.getName()' is recognizeable), then just read their FAQ: [http://commons.apache.org/fileupload/faq.html#whole-path-from-IE].

  • Can an Adobe search contain many file names to be retrieved in mass?

    In any Adobe product, is there a way to cut and paste a large list of file names, in one search, to be retrieved from a data base of 100,000+ searchable .pdf files?  What is the maximum file names allowed in one search?  Can you "mass" print (or save) the results of the search?
    We need a software product that can search for file names (entry numbers) within a huge searchable .pdf data base and retrieve the specific files listed on search to be printed or saved in mass.  Does anyone know if Adobe offers such a product?  I have read the specifics regarding Adobe search within the products, but I did not come away with the impression that Adobe could perform the type searches we are looking for?
    Please advise if you know of any software product that could mass extract specific files from data base into a print queue.
    Thank you so much!

    [discussion moved to Creating, Editing & Exporting PDFs forum]

  • Retrieve Message ID as File Name

    Hi Everyone,
    I am doing file to file Scenario.
         I have the following structure
    <?xml version="1.0"?>
    <message id=u201DmessageIDu201D>
    <header>
    </header>
    <body>
    </body>
    </message>
    I want to get retrieve MessageId and get this MessageId as File Name. How should i proceed.
    Regards,
    Varun

    Varun,
    Provide the message_id field as input to a UDF which used the DynamicConfiguration class to set the filename. The code in the UDF would be as below.
    DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http:/" + "/sap.com/xi/XI/System/File", "FileName");
    conf .put(key,  <input message_id paramter>);
    return "";
    Thanks,
    Anand

  • How can I retrieve file name being processed in Batch

    Hi All
    I want to retrieve the current filename that is being processed by a batch, e.g. A1~Texas~Actual~Jan-2010~RR.txt
    I can do this in various event scripts that have the strFile parameter but I need to do it in the BatchAction event script and cannot see how I go about it. I can see various objects in the API guide that should help me get at it but can't get it working.
    Has anyone done this before or got any pointers for how I can do this?
    Many thanks
    Stuart

    Hi Tony
    I have been able to retrieve this using the PstrFileName property in various event scripts, particularly those where strFile is a parameter and then used API.DataWindow.Utilities.fParsePath to trim that and provide just the file name. However thsi does not work in the BatchAction event script.
    I have found a property in the Batch Loader section of the supplementary API called PstrFileTitle but my VB is not strong enough to work out how to get at it. From what I can gather I would need to supply the BatchID (plus other parameters) to another function that would return this into a recordset and then read from the recordset (??) but I am not sure how to go about this.
    To give you some background, what I am trying to achieve is writing to a log file pre and during batch processing where the log file name should use the source file's name, e.g. 'SourceFile.txt' will write to SourceFile.log. The issue is that for batch processing we have to rename 'SourceFile.txt' s 'A1~Texas~Actual~Jan-2010~RR.txt' and I previously tried to use the PvarTempNC variables to store the source file name only to find that I could use that in the BatchAction event script!
    If you can point me in the right direction that would be great.
    Thanks
    Stuart

  • Retrieving file name using web agent

    When uploading to the database using interMedia web agent and an HTML form, is the file name (as well as the file contents) passed to the agent?
    If so, how does one retrieve the file name on the server side?
    Thanks for insight.
    -John

    Hi John,
    OK, you got me thinking, so I just had to look :-) Turns out its not in the documentation as such. Its in the doc changes section at the end of the README. (Because, now I really think about it, I added the code after the docs were last updated).
    Simon

  • Dreamweaver-upload an image's file name to DB, so it can be retrieved through a site folder

    I see a lot of help on how to save a file as a blog in an SQL database.  I would prefer to do it the recommended way, through a site folder.  I have a bunch of pictures that I want to match with various people (for a soccer team), and display those on a detail page.  I have the Dreamweaver Missing Manual, which gives tips on how to create a URL to retrieve the data. 
    So I have a field in the SQL database for the image, but my question is, when I create a file field on the form, select the image in my folder and click to select it, and submit the form, the file name (or path) doesn't show up in the SQL database or on the Detail page.  I feel like I'm missing one small element, and I hope that's the case. 
    Thanks in Advance for your help!

    To that end, isn't it enough to just update the SQL database of the location of the image, or does there have to be a transfer through the database so that a distinct connection to the image is established?
    No. That's not enough.  Two things need to happen:
    The image has to be uploaded to a specified location on the server (this is actually a multi-step process)
    The name of the image has to be saved in the database
    Then your code retrieves the name of the image and uses that name in a link, e.g.,
    <img src="path_to_the_image/<?php echo $rs_whatever['image_name']; ?>" />

  • Limit on the number of file names retrieved using FM 'RZL_READ_DIR_LOCAL'

    Hi All,
    I am using FM 'RZL_READ_DIR_LOCAL' , to retrieve file names from a specified directory.
    When executed, i am getting 10,000 records(file names) only against lakhs of files present in the directory.
    I would like to know if there is any limitation on the number of file names retrieved using that FM and how to over come it.
    Also please let me know if the FM 'EPS2_GET_DIRECTORY_LISTING' also has any such limitations.
    Thanks in advance,
    Sreeni Vallem

    I did not know about this limitation of number of files returned. You can give a try to the external command way of doing it in your development system.  Well, creating 10001 files in development is a boring job . You can write a sample program as Rob has mentioned in this thread and copy files to a specific directory ABAP: Copy files from one R3 directory to another. This doesn't disturb the existing program written.
    Mean while let's wait for expert's reply.
    Kesav

Maybe you are looking for