Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39092

Re: reading zip file

From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: reading zip file
Date 2019-08-08 22:38 +0200
Organization A noiseless patient Spider
Message-ID <qii198$kh3$1@dont-email.me> (permalink)
References <daa1fc10-39a1-4942-b9da-d7f5e1fa9907@googlegroups.com> <qihnc0$psl$1@dont-email.me> <4e7f0e43-d6cd-46c2-87ee-1cdf6bc24fc1@googlegroups.com>

Show all headers | View raw


On 2019-08-08 21:58, Eric Douglas wrote:
> On Thursday, August 8, 2019 at 1:50:03 PM UTC-4, Daniele Futtorovic wrote:
>> Yes. Don't do it like that. Save the ZIP file locally. Then extract it.
>> Don't do `EntityUtils.toByteArray()`. Stream the stuff. Same for the
>> extraction: streams, streams, streams.
>>
>> Incidentally, a IMHO cleaner and more modern approach to the problem
>> would be this:
>> One endpoint on the server that returns the list of files and the URL
>> *each* can be retrieved at. Another endpoint that returns each
>> individual file. You can add a GZIP filter at the transport level if
>> compression is required. But then it would be transparent to your code,
>> as well as to any tooling you might develop around this (think executing
>> requests manually in the browser for debugging purposes).
> 
> The download has to be a single zip file.  I didn't decide that.  That is how it's hosted on a third party application service.  Using an index and downloading separate files without the compression could make sense if the index can tell you the complete size of the files for the progress bar, and if we're worried about dropping the download in the middle and restarting.
> 
> Reading the file from the 'web service' would be faster than saving it to disk, as it's a Jetty based web service on a local domain server, and most users still have 7200 rpm hard drives.  I have recommended getting more ssds.  Writing it to disk only to stream it back in would only seem to make sense if the hard disk is definitely faster than the web service and there's likely not enough RAM to store the entire zip (and there should be plenty of disk space to store the zip), or they need to save the whole zip file for later anyway (in this case they don't).
> 
> I know I grabbed the unzip logic from the example (https://www.baeldung.com/java-compress-and-uncompress), not sure where I got the EntityUtils.toByteArray() method, not something I recall finding myself.

You're picking nickels in front of a steamroller.

-- 
DF.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

reading zip file Eric Douglas <e.d.programmer@gmail.com> - 2019-08-08 07:12 -0700
  Re: reading zip file Arne Vajhøj <arne@vajhoej.dk> - 2019-08-08 10:48 -0400
    Re: reading zip file Eric Douglas <e.d.programmer@gmail.com> - 2019-08-08 08:00 -0700
      Re: reading zip file Arne Vajhøj <arne@vajhoej.dk> - 2019-08-08 11:30 -0400
        Re: reading zip file Eric Douglas <e.d.programmer@gmail.com> - 2019-08-08 08:42 -0700
          Re: reading zip file Andreas Leitgeb <avl@logic.at> - 2019-08-08 17:51 +0000
          Re: reading zip file Arne Vajhøj <arne@vajhoej.dk> - 2019-08-08 17:17 -0400
      Re: reading zip file Joerg Meier <joergmmeier@arcor.de> - 2019-08-08 22:06 +0200
        Re: reading zip file Eric Douglas <e.d.programmer@gmail.com> - 2019-08-08 13:49 -0700
  Re: reading zip file Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-08-08 19:49 +0200
    Re: reading zip file Eric Douglas <e.d.programmer@gmail.com> - 2019-08-08 12:58 -0700
      Re: reading zip file Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-08-08 22:38 +0200

csiph-web