mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-19 03:18:57 +08:00
ZipFile.java: Compute the offset of the ZipEntry data correctly.
* java/util/zip/ZipFile.java: Compute the offset of the ZipEntry data correctly. From-SVN: r30439
This commit is contained in:
parent
309ca067d4
commit
a21d059766
@ -1,3 +1,8 @@
|
||||
1999-11-07 Anthony Green <green@trip.cygnus.com>
|
||||
|
||||
* java/util/zip/ZipFile.java: Compute the offset of the ZipEntry
|
||||
data correctly.
|
||||
|
||||
1999-11-05 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* java/lang/natThread.cc (destroy): Removed incorrect comment.
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user