MCPcopy Index your code
hub / github.com/dumbledore/AlbiteREADER / getInputStream

Method getInputStream

src/gnu/zip/ZipFile.java:412–464  ·  view source on GitHub ↗

Creates an input stream reading the given zip entry as uncompressed data. Normally zip entry should be an entry returned by getEntry() or entries(). This implementation returns null if the requested entry does not exist. This decision is not obviously correct, however, it does appear to mirror Su

(ZipEntry entry)

Source from the content-addressed store, hash-verified

410 * @exception ZipException if the Zip archive is malformed.
411 */
412 public InputStream getInputStream(ZipEntry entry) throws IOException
413 {
414 checkClosed();
415
416 Hashtable entries = getEntries();
417 String name = entry.getName();
418 ZipEntry zipEntry = (ZipEntry) entries.get(name);
419 if (zipEntry == null)
420 return null;
421
422 PartialInputStream inp = new PartialInputStream(rrf, 1024);
423 inp.seek(zipEntry.offset);
424
425 if (inp.readLeInt() != LOCSIG)
426 throw new ZipException("Wrong Local header signature: " + name);
427
428 inp.skip(4);
429
430 if (zipEntry.getMethod() != inp.readLeShort())
431 throw new ZipException("Compression method mismatch: " + name);
432
433 inp.skip(16);
434
435 int nameLen = inp.readLeShort();
436 int extraLen = inp.readLeShort();
437 inp.skip(nameLen + extraLen);
438
439 inp.setLength(zipEntry.getCompressedSize());
440
441 int method = zipEntry.getMethod();
442 switch (method)
443 {
444 case ZipEntry.STORED:
445 return inp;
446 case ZipEntry.DEFLATED:
447 inp.addDummyByte();
448 final Inflater inf = new Inflater(true);
449 final int sz = (int) entry.getSize();
450 return new InflaterInputStream(inp, inf)
451 {
452 public int available() throws IOException
453 {
454 if (sz == -1)
455 return super.available();
456 if (super.available() != 0)
457 return sz - inf.getTotalOut();
458 return 0;
459 }
460 };
461 default:
462 throw new ZipException("Unknown compression method " + method);
463 }
464 }
465
466 /**
467 * Returns the (path) name of this zip file.

Callers 1

openInputStreamMethod · 0.80

Calls 13

checkClosedMethod · 0.95
getEntriesMethod · 0.95
seekMethod · 0.95
readLeIntMethod · 0.95
skipMethod · 0.95
getMethodMethod · 0.95
readLeShortMethod · 0.95
setLengthMethod · 0.95
getCompressedSizeMethod · 0.95
addDummyByteMethod · 0.95
getMethod · 0.80
getSizeMethod · 0.80

Tested by

no test coverage detected