@Override public Checksum get() { return new CRC32(); } },
@Override public Checksum get() { return new Adler32(); } };
@Override public int read() throws IOException { return _inflateIn.read(); }
private InputStream getFromJar (String jarFile, String sharedLibrary) throws IOException { ZipFile file = new ZipFile(nativesJar); ZipEntry entry = file.getEntry(sharedLibrary); return file.getInputStream(entry); }
@Override protected InputStream decorateInputStream(InputStream is) throws IOException { return new GZIPInputStream(is); } });
@Override protected OutputStream decorateOutputStream(OutputStream os) throws IOException { return new GZIPOutputStream(os); } @Override
/** Setting a SharedLibraryFinder enables you to load libraries according to a nondefault natives jar layout or library names. * @param libraryFinder */ public void setSharedLibraryFinder (SharedLibraryFinder libraryFinder) { this.libraryFinder = libraryFinder; if (nativesJar != null) { try { nativesZip = new ZipFile(nativesJar); } catch (IOException e) { nativesZip = null; } } }
/** Disposal will happen automatically in {@link #finalize()} but can be done explicitly if desired. */ @SuppressWarnings("javadoc") public void dispose () { deflater.end(); }
@Override protected void update(byte[] bytes, int off, int len) { checksum.update(bytes, off, len); }
@Override public void write(byte[] buffer, int offset, int length) throws IOException { _deflateOut.write(buffer, offset, length); }
@Override public void reset() { checksum.reset(); } }
private ChunkBuffer (ByteArrayOutputStream buffer, CRC32 crc) { super(new CheckedOutputStream(buffer, crc)); this.buffer = buffer; this.crc = crc; }
private InputStream getFromJar (String jarFile, String sharedLibrary) throws IOException { ZipFile file = new ZipFile(nativesJar); ZipEntry entry = file.getEntry(sharedLibrary); return file.getInputStream(entry); }
/** Setting a SharedLibraryFinder enables you to load libraries according to a nondefault natives jar layout or library names. * @param libraryFinder */ public void setSharedLibraryFinder (SharedLibraryFinder libraryFinder) { this.libraryFinder = libraryFinder; if (nativesJar != null) { try { nativesZip = new ZipFile(nativesJar); } catch (IOException e) { nativesZip = null; } } }
/** Disposal will happen automatically in {@link #finalize()} but can be done explicitly if desired. */ @SuppressWarnings("javadoc") public void dispose () { deflater.end(); }
@Override protected void update(byte b) { checksum.update(b); }
@Override public void write(int ch) throws IOException { _deflateOut.write(ch); }
@Override public int read(byte[] buffer, int offset, int length) throws IOException { return _inflateIn.read(buffer, offset, length); }
private ChunkBuffer (ByteArrayOutputStream buffer, CRC32 crc) { super(new CheckedOutputStream(buffer, crc)); this.buffer = buffer; this.crc = crc; }