From ZipEntry to File without uncompressing?

Hello,
I have some third party Java code that requires a java.io.File for its constructor input argument. The third party code only needs to read the file. It does this using RandomAccessFile.
In my code I am originally working with a ZipFile. So my question is, is there a way to modify a ZipEntry to a java.io.File without uncompressing or writing to disk, so I can pass it to the third party software? Or do I have to unzip it, pass that file to third party code, and then delete it after all is complete?
// Get zip file
ZipFile zipFile = new ZipFile(args[0]);
// get the important zip entry
ZipEntry mainEntry = zipFile.getEntry("main.txt");
What do I do here to convert mainEntry to a
java.io.File without uncompressing/writing the
file to disk???? Is this possible????
// This is the third party object which requires a File for
// input and which I REALLY do not want to change.
ThirdPartyObject tro = new ThirdPartyObject(mainEntryFile);
tro.doStuff();

durban_z wrote:
I have some third party Java code that requires a java.io.File for its constructor input argument. The third party code only needs to read the file. It does this using RandomAccessFile.If it needs a random access file, you have no choice (without writing way too much code) but to give it a real file. OTOH, if the consumer only needs a stream, you can just pass the zip stream instead without writing to a file first.

Similar Messages

  • How can we get the artset from a .ai file without opening it?

    Hello All,
    I have one .ai file, lets say sample.ai file. located in C drive. so the complete file path is "C:\Sample.ai".
    and lets assume the sample.ai file has one traingle shape(3 path type arts) in it.
    Now I want to get the 3 path arts (artset)  from sample.ai file without opening it in AI.
    The function protoype is like below
    AIArtSet& artSet GetArtSetFromAFile( ai::FilePath& filePath );
    Is there any API like above function in AI? or is it possible to get the art(s) from a file without opening it in AI?

    Not to my knowlege. The API only operates on active documents as far as I know.

  • How can I convert files from pages 08 files without pages 09?

    I am extremely dissatisfied with the latest iWork (13?) applications. My 2008 MacbookPro crashed on me, so I purchased a new 15" MacbookPro last month. Due to a known issue that prohibits my new Mac from being restored from my Time Capsule backup (thanks, Apple...), we finally got it worked out so that all my files were restored, but I had to reinstall my applications as I could find them. I had iWork 09 on my old machine, but it was from a family pack years ago, for which I do not have the discs. So, now I don't have Pages 09 to convert all my older files (I had no legitimate reason to convert my graduate work from 08 because it all worked in '08 and '09) so that I can open all my .pages files in Pages. Why would Apple make Pages that cannot open .pages files?! This is quite frustrating, and I'm hoping someone has an answer for how to convert .pages files from iWork '08 so that I can open them in the latest Pages without having to purchase iWork '09 (AGAIN!). Apple is really ramping up its leaving people behind...

    Those are your choices.
    Buy iWork '09 which is a good solution or somehow reinstall Pages '08 so you can export to Word .doc/x files.
    We warned long and hard that not updating to Pages '09 would eventually lead to Pages '08 being left behind, although Apple was particularly ruthless the way it finally did it.
    Also that anything using Apple's proprietary formats is going to end up with the same fate.
    Peter

  • Extract thumbnail images from a cache file without originals?

    After an external drive crash, I'm left with only the Bridge (CS2) cache files for a folder full of images. Does anyone know a way to extract the thumbnails from the cache as jpgs or some other standalone format when you *don't* have the original image files? They would be low-res, but better than nothing. Thanks in advance.

    >>says that this export technique does not work, it produces a low res screen version of the file.
    Are you certain the original files were any better?
    My preferred method of doing this works well, but it takes a few extra steps. I'd make a high-res PDF out of the PM file, then pick apart the PDF to extract the graphics. Are the graphics raster or vector? If they're raster, you can use Acrobat's Touch-up Object tool to open them in Photoshop. If they're vector, you can open the PDF in Illustrator and save out the graphics from there.
    HTH

  • How to make PDF file size smaller from an Illustrator file without changing the quality or size (length and width) of the file?

    Is there a way to make a 30x42 size (40 GB) Illustrator file as a PDF but make the file smaller in size (able to email to clients) with out compromising the quality of the file or the size of the file?

    If you are working in RGB you can embed a colour profile. Embed ICC Profiles is one of the Acrobat save options. It will increase files size dramatically.
    When you save your pdf you can choose the compression method for placed images. Default is ZIP which is really no compression at all for pixel images. Instead you should opt for JPG compression (of varying degree according to how sensitive the images are to compression).
    You should also examine the other Acrobat save options. To minimize file size you should not have any of the options checked (Preserve Illustrator Editing Capability, Embed page Thumbnails etc. etc.).
    40 gigabytes for a file like the one you show is ridiculous. Did you maybe embed the placed images? If so, don’t. Keep them linked unless you really need to embed them.

  • Getting Package Name From Class File Without Parsing File

    I am writing an application where I need to get the package name from a class file without parsing the class file itself.
    Basically, what happens is the user chooses a class file from anywhere in the file system. I then want to use reflection to get information about that class. To do that I need the fully qualified class name. I know that the package name is part or all of the path name but I don't know for sure which part it is. I don't want to parse the class file directly for the package name in case the class file spec is changed (that way I won't have to rewrite any code).
    Does Java have any way of getting this information without doing something stupid like gradually stripping off part of the pathname and trying it?

    The ClassLoader way seems to work fine, copy a class file to "A.class" and run this:import java.io.*;
    class ClassLoaderExample {
        public static void main(String[] args) throws Exception {
            class MyClassLoader extends ClassLoader {
                public Class load() throws IOException {
                    File f = new File("A.class");
                    byte[] classData = new byte[(int) f.length()];
                    new RandomAccessFile(f, "r").readFully(classData);
                    Class loaded = defineClass(null, classData, 0, classData.length);
                    resolveClass(loaded);
                    return loaded;
            Class c = new MyClassLoader().load();
            System.out.println(c);
            System.out.println(c.newInstance());
    }

  • What is the best way to load and convert data from a flat file?

    Hi,
    I want to load data from a flat file, convert dates, numbers and some fields with custom logic (e.g. 0,1 into N,Y) to the correct format.
    The rows where all to_number, to_date and custom conversions succeed should go into table STG_OK. If some conversion fails (due to an illegal format in the flat file), those rows (where the conversion raises some exception) should go into table STG_ERR.
    What is the best and easiest way to archive this?
    Thanks,
    Carsten.

    Hi,
    thanks for your answers so far!
    I gave them a thought and came up with two different alternatives:
    Alternative 1
    I load the data from the flat file into a staging table using sqlldr. I convert the data to the target format using sqlldr expressions.
    The columns of the staging table have the target format (date, number).
    The rows that cannot be loaded go into a bad file. I manually load the data from the bad file (without any conversion) into the error table.
    Alternative 2
    The columns of the staging table are all of type varchar2 regardless of the target format.
    I define data rules for all columns that require a later conversion.
    I load the data from the flat file into the staging table using external table or sqlldr without any data conversion.
    The rows that cannot be loaded go automatically into the error table.
    When I read the data from the staging table, I can safely convert it since it is already checked by the rules.
    What I dislike in alternative 1 is that I manually have to create a second file and a second mapping (ok, I can automate this using OMB*Plus).
    Further, I would prefer using expressions in the mapping for converting the data.
    What I dislike in alternative 2 is that I have to create a data rule and a conversion expression and then keep the data rule and the conversion expression in sync (in case of changes of the file format).
    I also would prefer to have the data in the staging table in the target format. Well, I might load it into a second staging table with columns having the target format. But that's another mapping and a lot of i/o.
    As far as I know I need the data quality option for using data rules, is that true?
    Is there another alternative without any of these drawbacks?
    Otherwise I think I will go for alternative 1.
    Thanks,
    Carsten.

  • Excel data filtration using oledb from huge excel files size approx (200mb) using c# (ADO)

    hi,
    My ado application requires to read data from one xlsx file(Approx 10-20MB min) and then process the data row by row and compare with
    another xlsx file( approx size 250 MB min) containing over 1000000 rows with 63 columns (work like database).
    when i try to read the database file (250 MB) and run the oledb data queries on it, it's working so strange, its only give the first matched data from the database file. but if i opened that xlsx database file in office excel and then run my application
    its return all matched data from the database file without changing any code.
    i already checked my dataquery its working fine in server Explorer and returns the complete result.
    this process also very time consuming ,
    i already tried openxml sax mathod to resolve the performance issue as well, but its not worked too. even it takes more time compare to oledb to read the excel.
    i also have two another issues in my application,
    1. sometime oledb returns an exception 'System resource exceeded' and
    2. some time return 'internal ole automation error' .
    i also tried google to resolve these issue but i didn't find any solution for my problem.
    is there any solution to resolve these issues?  please help me. any suggestion appreciated but please remember one thing i can't change any xlsx table format because i don't have rights, these xlsx files automatically generated by another tools by our
    sourcing partners.
    thanks.

    Please see this.
    http://www.sqlis.com/post/Looping-over-files-with-the-Foreach-Loop.aspx
    Or, if you don't have SSIS, do Bulk Insert by looping through the files.  Let's say the files have something in common, like a date in the name of the file.  Simply run this SQL Server script . . . 
    DECLARE @intFlag
    INT
    SET @intFlag
    = 1
    WHILE (@intFlag
    <=48)
    BEGIN
    PRINT @intFlag
    declare @fullpath1
    varchar(1000)
    select @fullpath1
    = '''\\ftp\your_path\'
    + convert(varchar,
    getdate()- @intFlag
    , 112)
    + '_your_file.txt'''
    declare @cmd1
    nvarchar(1000)
    select @cmd1
    = 'bulk insert [dbo].[your_table] from '
    + @fullpath1 +
    ' with (FIELDTERMINATOR = ''\t'', FIRSTROW = 2, ROWTERMINATOR=''0x0a'')'
    exec (@cmd1)
    SET @intFlag
    = @intFlag + 1
    END
    GO
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Need help booting from DMG file without DVD drive

    okay so i have 6 computers with me right now. i need to use one that has a dvd drive to install it on a comp that doesnt via firewire.
    1- macbook with superdrive and os 10.5 (cant even open tiger install because its a new macbook
    2-iBook g4 with DVD drive BUT the firewire port is broken
    3-iBook g3 (one that needs tiger but only has a cd drive)
    4-ibook g3 (without dvd drive)
    5-powerbook g4 with dvd drive and firewire (for some reason will not read the tiger discs i just burned, even though ive already used them on the ibook g4
    6-mac pro with firewire and dvd drive, but the dvd drive is broken.
    so seems to me, every computer i have has a weakness for exactly what i need. what i need to know now is if i can boot the powerbook g4 from a DMG file of tiger install disc 1 and install is to the target ibook through firewire. if you have any suggestions on what i should try with the supplies mentioned above, please inform me. thanks!

    what i need to know now is if i can boot the powerbook g4 from a DMG file of tiger install disc 1 and install is to the target ibook through firewire.
    You can't unless the PowerBook is running Mac OS X Server, in which case the NetInstall feature can be used.
    (38733)

  • How do I get Adobe Acorbat to open a .pdf file from a sharepoint library without having to checkout the file

    I have a customer that is using Adobe Acrobat pro version 10.1. When they try and open a .pdf file from a SharePoint site, the user is prompted to check out and open the file or open the file. Is there a way to get Adobe Acrobat to open the .pdf file without prompting to check out or open?
    Thanks
    Jim

    This is mostly a lion thing, rather than a PSE thing. To disable applications opening where they left off last time for all the programs on your computer, go to system preferences>general and untick this box:
    You can also do on a per-program basis, but it's more complicated and the best thing to do is to search around for directions on the web and see which way is least uncomfortable for you.
    There's an odd little glitch in PSE that it opens the last image you had open, even if you closed it before quitting last time. Adobe says this is correct behavior, but of course it isn't.

  • How to get total number of pages from .doc file without using Office interop?

    Hi,
    Kindly help me in getting the total number of pages from a .doc file not .docx file using C#. I know how to get by using Office interop but I do not want to use Office interop.
    So, without office automation in C# let me know how to get the total number of pages from a .doc file.
    Regards,
    Ashok

    Hi Ashok,
    >> I know how to get by using Office interop but I do not want to use Office interop
    Could you tell us why you don't want to use Office interop?
    As far as I know, this is the easiest way to achieve.Hmmm,this is my answer
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.pagenumbers.startingnumber(v=office.14).aspx
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Regarding reading the data from the files without using Stremas

    hai to all of u...
    here i have a problem where i have to read the data from the files without using any streams.
    please guide me how to do this one,if possible by giving with an example
    Thanks & Regard
    M.Ramakrishna

    Simply put, you can't.
    By why do you need to?

  • How do I import images from my hard drive without losing resolution? My original files after import are significantly smaller. What should I do?

    How do I import images from my hard drive without losing resolution? My original files after import are significantly smaller. What should I do?

    Hi Keith, and all others chiming in, I do have the correct option checked in advanced settings telling iPhoto to copy the images into the library. What is a refernced library? Perhaps this is where I am getting confused. I exported my entire photo library from an old iMac5 to my external hard drive, from there I attempted to import the entire library to my new iMac. Am I overlooking an obvious and easy way to import from the hard drive to the new iMac--I dragged the entire photo pholder from the hard drive to the open window of iPhoto on the new computer. Now, I only get preview file sizes in iPhoto, unless I have my external drive open. Perhaps I need to import the original images from the hard drive in a different way...?! (This is making me feel pretty stupid.)

  • I want to send a value from JSP file to another JSP file without..

    I want to send a value from one.JSP file to another two.JSP file without to show the content HTML of the one.JSP in two.JSP (with include), only take the values processed in a Bean :
    ===================
    Bean
    package pck;
    import java.io.*;
    public class yyyy {
         public String getXxx() {    
              return cccc;
    ========================
    one.JSP
    <jsp:useBean id="idBean" class="pck.yyyy" scope="??"/>
    <%idBean.setXxx(ccc);%>
    ========================
    two.JSP
    <%@ include file="one.jsp"%>
    <%=idBean.getXxx()%>
    but without to show the content HTML of one.JSP in two.JSP.
    Can someone help me?, please.

    Why don't just put the common code in a separate file and include it in both. i.e. the code that is in one.jsp that is needed by two.jsp could be put in a common file and included in both pages, thus the HTML is separated off. If this will not work, set a boolean value in two.jsp that can be used by one.jsp to decide if the HTML should be displayed or not.
    Steve

  • How to transfer files from mac to ipad without using itunes

    how to transfer files from mac to ipad without using itunes ???
    as i want to use my ipad for official use as well...please suggest..

    well to be 100% technical, no you didn't but that aside, it good to know there are ways for people to transfer music into the default apps without iTunes, if they have a need.
    I tend to use 3rd party apps for documents, like your mentioned iExplorer etc, which are handy.
    I see from a search the two "apps" you mentioned are not iOS apps, which I had assumed, SyncPod and FreeSync are apps for your computer, that would explain their access to the default Music/Video apps.
    I had wondered how Apple had allowed iOS apps in the store that could get around the sandboxing in iOS of apps.
    Message was edited by: CGW3

Maybe you are looking for

  • Yoga 2 Pro won't recognize my Seagate external hard drive

    I have a Yoga 2 Pro that won't recognize my Seagate Backup Slim 2TB USB 3.0 external hard drive.  I ordered one from Amazon and it didn't recognize immediately when I plugged it in. The disk drive shows up in Devices and in Device manager with the Ye

  • Downloading Mountain Lion upgrade from App Store failed

    I'm upgrading my wife's iMac from Snow Leopard 10.6.8 to Mountain Lion. Just tried to download the Mountain Lion upgrade from the App Store. I paid for it, clicked on the download, the little icon did it's fancy leap down to the application bar at th

  • FM FI_ITEMS_MASS_CHANGE  not working where FB02 authorisation is not there

    Hi, I am using function module FI_ITEMS_MASS_CHANGE  to remove payment block alternative of FB02. It is working fine with userid having FB02 authorisation through workflow. But user who will access the system won't have FB02 authorisation. So how can

  • Several folder shares on Windows Server 2003 R2

    I have serious problems at one of our clients. They just switched from PC's to iMac's and MacBook Pro's. The backup platform is a server running Microsoft Windows Server 2003 R2 and there are several shares on this server. Some of these shares should

  • NI 9014 is not detect NI network browser and MUX

    Hi, I have been dealing with NI cRio 9014. Now, I face a problem with detecting the cRio in MUX and NI network browser after upgrading  the new drives and Labview software. Simply it doesn't detect at all. I have set correct subnet and IP in my machi