Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39084
| Path | csiph.com!aioe.org!.POSTED.O5hsyUvK01te0L/SZurVSQ.user.gioia.aioe.org!not-for-mail |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: reading zip file |
| Date | Thu, 8 Aug 2019 10:48:05 -0400 |
| Organization | Aioe.org NNTP Server |
| Lines | 26 |
| Message-ID | <qihcn4$1mo7$1@gioia.aioe.org> (permalink) |
| References | <daa1fc10-39a1-4942-b9da-d7f5e1fa9907@googlegroups.com> |
| NNTP-Posting-Host | O5hsyUvK01te0L/SZurVSQ.user.gioia.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
| Content-Language | en-US |
| X-Notice | Filtered by postfilter v. 0.9.2 |
| Xref | csiph.com comp.lang.java.programmer:39084 |
Show key headers only | View raw
On 8/8/2019 10:12 AM, Eric Douglas wrote:
> I'm working on a new client-server application which requires saving client files to disk for every client that runs it. All files required by the client are in a zip file, hosted by a web service on a local domain server.
> I'm writing the unzipped files to the client machine using this loop.
>
> ZipEntry zipEntry = null;
> try (ByteArrayInputStream is = new ByteArrayInputStream(zipBytes); ZipInputStream zis = new ZipInputStream(is)) {
> while ((zipEntry = zis.getNextEntry()) != null) {
>
> The zipBytes is a byte[] array generated from org.apache.http.util.EntityUtils.toByteArray(). The zip file is currently over 400 MB. I'm not sure how big this could potentially get. Do I have to get the entire zip file into memory before extracting? Should I be concerned how much memory this could require? Is there a better way?
If the binary ZIP file is URL encoded then it is a big mess.
If the binary zip file is present as binary data, then I think you can
change from:
ZipInputStream zis = new ZipInputStream(new
ByteArrayInputStream(EntityUtils.toByteArray(entity)));
to:
ZipInputStream zis = new ZipInputStream(entity.getContent());
(code simplified)
Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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