home *** CD-ROM | disk | FTP | other *** search
- package java.util.zip;
-
- import java.io.IOException;
- import java.io.InputStream;
-
- class ZipFileInputStream extends InputStream implements ZipConstants {
- // $FF: renamed from: zf java.util.zip.ZipFile
- private ZipFile field_0;
- // $FF: renamed from: ze java.util.zip.ZipEntry
- private ZipEntry field_1;
- private long pos;
- private long count;
-
- ZipFileInputStream(ZipFile var1, ZipEntry var2) throws IOException {
- this.field_0 = var1;
- this.field_1 = var2;
- this.readLOC();
- }
-
- public int available() {
- return (int)Math.min(this.count, 2147483647L);
- }
-
- public int read(byte[] var1, int var2, int var3) throws IOException {
- if (this.count == 0L) {
- return -1;
- } else {
- if ((long)var3 > this.count) {
- var3 = (int)Math.min(this.count, 2147483647L);
- }
-
- var3 = this.field_0.read(this.pos, var1, var2, var3);
- if (var3 == -1) {
- throw new ZipException("premature EOF");
- } else {
- this.pos += (long)var3;
- this.count -= (long)var3;
- return var3;
- }
- }
- }
-
- public int read() throws IOException {
- if (this.count == 0L) {
- return -1;
- } else {
- int var1 = this.field_0.read(this.pos);
- if (var1 == -1) {
- throw new ZipException("premature EOF");
- } else {
- ++this.pos;
- --this.count;
- return var1;
- }
- }
- }
-
- public long skip(long var1) {
- if (var1 > this.count) {
- var1 = this.count;
- }
-
- this.pos += var1;
- this.count -= var1;
- return var1;
- }
-
- private void readLOC() throws IOException {
- byte[] var1 = new byte[30];
- this.field_0.read(this.field_1.offset, var1, 0, 30);
- if (ZipFile.get32(var1, 0) != 67324752L) {
- throw new ZipException("invalid LOC header signature");
- } else {
- this.count = this.field_1.csize;
- this.pos = this.field_1.offset + 30L + (long)ZipFile.get16(var1, 26) + (long)ZipFile.get16(var1, 28);
- if (this.pos + this.count > this.field_0.cenpos) {
- throw new ZipException("invalid LOC header format");
- }
- }
- }
- }
-