diff options
author | green <green@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-11-07 08:30:31 +0000 |
---|---|---|
committer | green <green@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-11-07 08:30:31 +0000 |
commit | c37812572dd3c80be9fb44f2626582196e5baed2 (patch) | |
tree | b06c0ea4832a961f7d530839fbda063f08ac1992 /libjava/java/util/zip/ZipFile.java | |
parent | dea5edae70dd1b89a4ac7ef992c213f9a2772630 (diff) | |
download | ppe42-gcc-c37812572dd3c80be9fb44f2626582196e5baed2.tar.gz ppe42-gcc-c37812572dd3c80be9fb44f2626582196e5baed2.zip |
* java/util/zip/ZipFile.java: Compute the offset of the ZipEntry
data correctly.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30439 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/util/zip/ZipFile.java')
-rw-r--r-- | libjava/java/util/zip/ZipFile.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java index 1b0ebcee8ba..5eabb125079 100644 --- a/libjava/java/util/zip/ZipFile.java +++ b/libjava/java/util/zip/ZipFile.java @@ -122,10 +122,13 @@ public class ZipFile implements ZipConstants public InputStream getInputStream(ZipEntry ze) throws IOException { byte[] buffer = new byte[(int) ze.getSize()]; - int data_offset = ZipConstants.LOCAL_FILE_HEADER_SIZE + name.length(); - if (ze.extra != null) - data_offset += ze.extra.length; - file.seek(ze.relativeOffset + data_offset); + + /* Read the size of the extra field, and skip to the start of the + data. */ + file.seek (ze.relativeOffset + ZipConstants.LOCAL_FILE_HEADER_SIZE - 2); + int extraFieldLength = readu2(); + file.skipBytes (ze.getName().length() + extraFieldLength); + file.readFully(buffer); InputStream is = new ByteArrayInputStream (buffer); |