Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8893317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:13:00+00:00 2026-06-14T23:13:00+00:00

here is my problem, so far I’ve compressed a file (.zip) and also in

  • 0

here is my problem, so far I’ve compressed a file (.zip) and also in another application I can request to the system to display a file with the application that the system has as default to open “that” kind of file (.txt -> notepad, .doc(x) -> Word, .psd -> Photoshop, etc…) (Desktop.getDesktop().open(f);), the problem is, how can I request to the system to display a file that is inside the zip file without unzipping it?

for example using Winrar you can see the content of the zip, and if you double click over one of the files inside, the file is open with the preferred/default viewer/editor of the system, and the .zip file remains zipped (apparently, or at least you did not need to uncompressed the entire .zip to have access to the file you want) is it possible to do that with java? (and preferably only using java).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:13:01+00:00Added an answer on June 14, 2026 at 11:13 pm

    To be able to pass the file itself to another application you need to extract it somewhere, otherwise other applications can’t have access to it.

    Actually this is how WinRAR does, in Java you can do it through ZipFile and ZipEntry and yes, you will have to extract it for sure.

    Java itself caches files in the folder specified by the property "java.io.tmpdir" so I guess you could try to look for them when processing the zip entries so that they will be automatically deleted by the JVM upon termination without bothering yourself.

    To pipe a ZipInputStream to a file you can just use an utility function like this one (I personally used it to work with zip files so I tested it):

     private static void copy(InputStream in, OutputStream out) throws IOException {
        byte[] buffer = new byte[8192];
        while (true) {
          int readCount = in.read(buffer);
          if (readCount < 0) {
            break;
          }
          out.write(buffer, 0, readCount);
        }
      }
    

    To be used as

    File file = new File(..);
    FileOutputStream fos = new FileOutputStream(file);
    ZipInputStream zis = zipFile.getInputStream(entry);
    copy(zis,fos);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
I have a problem here im trying to upload a file first time it
I have a problem here I can't solve. I have a database of houses
I've got a strange problem here. I have a class that I'll call MainView
I'm having a little 'teething' problem here is my code so far <form name=job_app>
Having a weird problem here. Everybody knows that if you use web.config's customErrors section
I have a problem here and it seems that my brain has just left
Here is the situation: I have to create a program that would input another
I have quite the problem here. I have an MVP application where I have
you can find an example of my problem here: http://la.truxmap.com/truckpage?id=buttermilktruck the text content can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.