History log of /libcore/luni/src/main/java/java/util/zip/ZipInputStream.java
Revision Date Author Comments
0aff1dd0b4be1b8d8cb45b59079ca883a1b3205a 17-Jun-2014 Elliott Hughes <enh@google.com> Remove.

(cherry-pick of 63744c884dd4b4f4307f2b021fb894af164972af.)

Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
63744c884dd4b4f4307f2b021fb894af164972af 17-Jun-2014 Elliott Hughes <enh@google.com> Remove.

Change-Id: Ibf79a402e1bad98a262e380fcee3d35c127ae6d5
e8a958066d95a4e15a9834e8b9067d106efd9b53 15-Jun-2014 Elliott Hughes <enh@google.com> @hide.

Change-Id: Ieacf34a7b850910e70ae54f738608509e2c39e2e
e9ed1b1450852172a48f9811ebb09d25f2f7e140 08-May-2014 Neil Fuller <nfuller@google.com> Unhide further 1.7-era APIs

Change-Id: I15ef2991b03a9503d6917a7f3351b32f42f662fb
e3d756c5dae1af2aa5f0ad8bc7f133df3e7401eb 11-Mar-2014 Neil Fuller <nfuller@google.com> Add Java 1.7 APIs: ZipFile, ZipInputStream, ZipOutputStream

Add constructor support for the character encoding to use.

When reading a ZipFile this is used for the file comment and for
entry names and comments when a zip entry is not self-described
as UTF-8 encoded.

When writing a zip file the character encoding determines the
encoding used for the file comment, entry names and comments.

The default for reading and writing when the character encoding
is not specified remains as UTF-8.

Additional fix:
ZipOutputStream: null comments no longer cause NullPointerException.

Change-Id: I7cadfa939377d0f87fd5503dae2a0b2dbac2ba39
1222b64d823e028efa6f02b08a55d788bfd57b16 07-Nov-2013 Narayan Kamath <narayan@google.com> Make some sense of Jar parsing / verification

This is the first step towards the end goal of
decoupling JarVerifier / Manifest & ManifestReader
from the public API classes JarFile & JarInputStream.

- This removes some horrible looking hacks

My goal is to decouple JarVerifier / Manifest &
ManifestReader from JarFile / ZipFile and friends.

This also necessiated a pretty big rewrite of JarInputStream
and hopefully it reads a lot clearer now.

- Fix some weird variable naming & null checks
- Remove some horrible message passing code between
JarInputStream and ZipInputStream
- Also, create a BAOS with the appropriate size,
if available.

Tested: harmony/archive.tests.java.util.jar.JarInputStreamTest
Tested: harmony/archive.tests.java.util.jar.JarFileTest

bug: 10193060

Change-Id: I7c39f2cc92a62a2110627ee6473df43d3efb3fe3
44e8930b48015aacbad027c5a8d9a4c7e00e329e 06-Aug-2013 Elliott Hughes <enh@google.com> Bumper ZipFile/ZipEntry backport.

Bug: https://code.google.com/p/android/issues/detail?id=58465
Bug: 8219321
Bug: 8476102
Bug: 8617715
Bug: 9695860
Bug: 9950697
Bug: 10148349
Bug: 10227498
Change-Id: I94c3e9664a429c94c336115618a46283a13996e0
325ff8c68ed5e530e9e1d487b9e2e6d8f8e2bd37 25-Jun-2013 Elliott Hughes <enh@google.com> Clean up the #read javadoc.

By being more consistent in parameter naming, we can inherit more javadoc.

Also fix a couple of javadoc warnings in KnownFailure and DataInputStream.

Change-Id: I778f40469404fb50c51cdb1068970974f923180c
25681be69e19a834b00cfbf54cd99ac13f12b9ff 17-Apr-2013 William Luh <williamluh@google.com> Only enforce the encrypted bit in the GPBF, and ignore other unsupported bits.

(cherry-pick of 7a302a49a7c8b99e2f34fff660e199fb7c776bc1.)

Bug: 8617715
Change-Id: Ibfe919d67fd17cee050d23811faa5aa64116dfb4
941d18fe01a8b2b69c67a006d1f3d855bdccde95 17-Apr-2013 William Luh <williamluh@google.com> Only enforce the encrypted bit in the GPBF, and ignore other unsupported bits.

Bug: 8617715
Change-Id: I2f906ae6107d2bdf990a7991f56d4a0873bca634
7a302a49a7c8b99e2f34fff660e199fb7c776bc1 17-Apr-2013 William Luh <williamluh@google.com> Only enforce the encrypted bit in the GPBF, and ignore other unsupported bits.

Bug: 8617715
Change-Id: I2f906ae6107d2bdf990a7991f56d4a0873bca634
6aed748da1deaa820d574446037401893d73be9b 02-Apr-2013 William Luh <williamluh@google.com> Don't install APK files with unsupported General Purpose Bit Flag bits.

Bug: 8476102

(cherry picked from commit d0bd4c19678429b19ac4b9c7477b28241d5dd1db)

Change-Id: I03f19095ac4e6f8abcb61ba6c120227c2df1f2d1
d0bd4c19678429b19ac4b9c7477b28241d5dd1db 02-Apr-2013 William Luh <williamluh@google.com> Don't install APK files with unsupported General Purpose Bit Flag bits.

Bug: 8476102
Change-Id: I764c2aec944558129c8ac04ee0593fb3de82870e
f05aeedc00c8e7ab7650067ce1dc301547a3914b 10-Dec-2012 Elliott Hughes <enh@google.com> More java.util.zip documentation improvements.

Change-Id: I8ebc23b8a7a7affee0fd3756c3861cf5b6c07ee4
13f30b9167639ad63da1707102db6320e8f76474 08-Dec-2012 Elliott Hughes <enh@google.com> Clean up ZipFile a little, fix a few bugs, and improve the documentation.

The main bug fixed is fixing support for .zip files larger than 2GiB (where
the central directory offset's top bit is set).

We were checking character counts rather than byte counts in several places
too, which could lead to corrupt zip files.

I've also added a comment to readCentralDirectory because I keep coming back
to this code, wanting to make it lazy, and never remember (until I've done
half the work) why that's not possible.

I've also clarified a lot of the documentation.

Bug: http://code.google.com/p/android/issues/detail?id=36187
Change-Id: Iaa8eadc501ead7c70528bd9063d5893a325dcea1
d43b9ef11a1095967a3396b246639b563e1a4128 12-Sep-2012 Kenny Root <kroot@google.com> Add consistent reasons for NullPointerException

Semi-automated replacement of empty and non-conforming
NullPointerException reason messages.

(cherry-pick of 86acc043d3334651ee26c65467d78d6cefedd397.)

Change-Id: I6d893979f5c20a50e841e32af9fd7b2d8bc9d54d
86acc043d3334651ee26c65467d78d6cefedd397 12-Sep-2012 Kenny Root <kroot@google.com> Add consistent reasons for NullPointerException

Semi-automated replacement of empty and non-conforming
NullPointerException reason messages.

Change-Id: Iedeb4b21949e973c4042ce5982dda315f2e785e1
9f050bd1d16b822532430c897991e27a58605ff5 11-Jan-2012 Elliott Hughes <enh@google.com> Fix an ICS regression with zip files containing >= 32768 entries.

The usual signed/unsigned 16-bit field problem with zip files. In adding a unit
test I also found two other long-standing bugs:

1. We had O(N^2) behavior when adding files. Someone used an List where they
wanted a Set. Fixed by switching that code over to a Set.

2. We were allowing people to create .zip files with > 64Ki entries but
generating a file that would claim to have (entryCount & 0xffff) entries.
Fixed to throw ZipException until we have proper Zip64 support.

Bug: http://code.google.com/p/android/issues/detail?id=23207
Change-Id: Ice9c9790782639ba50e1ca057bc2cf21a945e147
f934c3d2c8dd9e6bc5299cef41adace2a671637d 15-Mar-2011 Elliott Hughes <enh@google.com> Make OSMemory the semi-supported libcore.io.Memory.

Looks like we're not going to bother with a separate libcore.os package,
when libcore.io will do.

Change-Id: I2806c59349ed4b6410d768c4207c384ced973c54
f5309a39506c967feda8766feeba7f7271a458cb 25-Feb-2011 Elliott Hughes <enh@google.com> Fix more FindBugs warnings: RR_NOT_CHECKED.

"This method ignores the return value of one of the variants of
java.io.InputStream.read() which can return multiple bytes. If the return
value is not checked, the caller will not be able to correctly handle the
case where fewer bytes were read than the caller requested. This is a
particularly insidious kind of bug, because in many programs, reads from input
streams usually do read the full amount of data requested, causing the
program to fail only sporadically."

Change-Id: I7d7c62836f2037f0cbb4bb0708bd4f034a22a2fc
6186821cb13f4ac7ff50950c813394367e021eae 08-Feb-2011 Jesse Wilson <jessewilson@google.com> Move libcore.base classes to libcore.util and libcore.io.

Change-Id: I2340a9dbad3561fa681a8ab47d4f406e72c913e3
b9cc455ed89df1a0cf4186c92b352c9649995d96 04-Dec-2010 Elliott Hughes <enh@google.com> Use our canonical Arrays range-checking methods.

There are a handful of manual range-checkers left, thanks to specified
API that throws IllegalArgumentException instead, and a few other weird
cases.

Change-Id: I80914c2257288fc184100545aff4fd6f57bf32c9
2d9c5fa8ce0182cd8c14736241b709fd50cab6f8 23-Nov-2010 Elliott Hughes <enh@google.com> Slight cleanup of java.util.zip code, plus a bug fix.

The key fix is switching to zstream's next_in and next_out fields (the
pointers into the input and output buffers) rather than relying on the
integer "accounting" fields. If turns out in the Z_NEED_DICT case that
the accounting goes slightly awry. (We shouldn't have been using the
accounting anyway, because we were silently coercing longs to ints.)
The new code is simpler, clearer, and doesn't need a special case for
Z_NEED_DICT at all.

I've also removed yet another hand-written UTF-8 encoder, made Inflater
throw ArrayIndexOutOfBoundsExceptions with useful detail messages (factored
out into Arrays so we can make this change more widely), and
rewritten the Inflater and Deflater documentation.

The unit test reproduces the problem (and tests as many other cases as
it can too). Critical for testing this bug is that we needed to limit
the size of the input buffer so that zlib has to ask us for more input.

Bug: 3220923
Change-Id: I39e5456620eaa7f75d12d885db279f009ee3e8ef
fd2d7c4f244a78ee74db4944acf2a6378b65d43b 12-Nov-2010 Elliott Hughes <enh@google.com> More java.util.zip documentation improvements.

Follow-on to https://android-git.corp.google.com/g/79392.

Change-Id: I7ebdb5f0824d30e0b86d4e1ac236377bbda1cd08
d42697f6a5bac5d8789c82f45f79f7dd195dc768 11-Nov-2010 Elliott Hughes <enh@google.com> Better documentation for GZIPInputStream/GZIPOutputStream/ZipInputStream/ZipOutputStream.

I didn't know how to use ZipInputStream/ZipOutputStream off the top of my
head; that's a sign we need an example in the documentation.

Change-Id: I0410927a4a784991ff183c30c4cf59752b7ed8e8
e43b3f6c7b343f4b6c738120a2ac2f93c5bd9a8e 10-Nov-2010 Elliott Hughes <enh@google.com> Fix a bug I introduced, and do more zip cleanup.

This code's quite hairy in its use of int/long. I can't just change the fields
to int because they seem to use -1L to mean "unset" while still allowing the
whole int range of values (including -1). We'll have to look at the zip
specification to see whether that's right, but for now, let's just avoid sign
extension.

I've also cleaned up some of the other code, most notably throwing more
detailed exception messages where it's easy, and removing hand-made readFully
implementations.

Bug: 3181430
Change-Id: I382568a8975c9b8b2ee5b344817134472369d308
b5bde2fd72189192b52e726a2d606d70c3c8a34b 02-Nov-2010 Elliott Hughes <enh@google.com> More shift removal.

A few more customers for OSMemory's peek/poke abilities, and a bunch of shifts
that should have been multiplications.

Bug: 3032515
Change-Id: Ic518fd8f7565d67523ea10e3f5afca3a9c8501b8
80b486724ca19b3c1c3c36334d06856330362f83 01-Oct-2010 Jesse Wilson <jessewilson@google.com> Simplify skip() to use skipByReading or the superclass where possible.

Several classes were overriding InputStream.skip() but not doing
anything better than the base class. These were deleted.

Others were allocating skip buffers which was correct, but duplicated
code with our Streams utility class.

The CipherInputStream class had a skip method that always skipped
0 bytes. This has been fixed and tested.

Change-Id: Ic96c600e111c11cf7364b4e0a721791d7e3c2ae1
8cfafd33742282beb20c6971aafc1feb35e3fa5e 03-Sep-2010 Jesse Wilson <jessewilson@google.com> Fix jtreg test failures when we weren't throwing on bad parameters.

See http://b/2224959

Change-Id: I9f572d08328dda280a77287a228072d33fcbea85
e810d3b49631329b11440aa5b7a54db181d42ed1 15-Jun-2010 Elliott Hughes <enh@google.com> More charset-related cleanup/optimization.

This patch adds a Charsets class that lets us avoid a hash lookup and an extra
level of method call indirection when calling String.getBytes or "new String"
for a well-known guaranteed charset. It also fixes callers to take advantage.

This also adds a special case to "new String" for the UTF-8 charset to avoid
needless duplication if we guessed the correct buffer size (which we will for
input that happens to be US-ASCII too).

The ModifiedUtf8 class gives a more meaningful name for Utils.convertUTF8WithBuf.

This also removes a dead link and un-tinyurl'ed another.

Change-Id: I02712f53dee16feb3b1db2c14536dc055126cd04
c941a854631c4bf2369adc84887bb6dd386a1bcc 22-May-2010 Elliott Hughes <enh@google.com> Fix build.

Change-Id: I61d838fdb9147b1e488cf6c9ea0aa1e1e87f935e
b1433b3bd4dfc05426e5d9c3100b5fbaa198d8a0 21-May-2010 Elliott Hughes <enh@google.com> More messages.properties removal.

Change-Id: Ie90ca910b1d9f23565f8929c63186879932a4dc3
f33eae7e84eb6d3b0f4e86b59605bb3de73009f3 13-May-2010 Elliott Hughes <enh@google.com> Remove all trailing whitespace from the dalvik team-maintained parts of libcore.

Gentlemen, you may now set your editors to "strip trailing whitespace"...

Change-Id: I85b2f6c80e5fbef1af6cab11789790b078c11b1b
fd6bb3510c2f94d636f3572dcf5f7f4dcd1a2726 13-May-2010 Elliott Hughes <enh@google.com> Remove //$NON-NLS-\d$ cruft.

Mostly done by perl(1), with manual cleanup of the few misspelled instances.
This makes our trailing whitespace slightly worse, but I'll fix all that with
a follow-on change.

Change-Id: I0b4ca98819be6f9519c4ba980d759bd1ee1a0303
cec4dd4b1d33f78997603d0f89c0d0e56e64dbcd 26-Apr-2010 Peter Hallam <peterhal@google.com> merge more modules into luni