/** * Write bytes to output or random access file. * @param data the byte array to write * @throws IOException on error */ private void writeCounted(final byte[] data) throws IOException { streamCompressor.writeCounted(data); }
public void writeCounted(final byte[] data) throws IOException { writeCounted(data, 0, data.length); }
void deflate() throws IOException { final int len = def.deflate(outputBuffer, 0, outputBuffer.length); if (len > 0) { writeCounted(outputBuffer, 0, len); } }
/** * Writes bytes to ZIP entry. * * @param b the byte array to write * @param offset the start position to write from * @param length the number of bytes to write * @param method the comrpession method to use * @return the number of bytes written to the stream this time * @throws IOException on error */ long write(final byte[] b, final int offset, final int length, final int method) throws IOException { final long current = writtenToOutputStreamForLastEntry; crc.update(b, offset, length); if (method == ZipEntry.DEFLATED) { writeDeflated(b, offset, length); } else { writeCounted(b, offset, length); } sourcePayloadLength += length; return writtenToOutputStreamForLastEntry - current; }
private void copyFromZipInputStream(final InputStream src) throws IOException { if (entry == null) { throw new IllegalStateException("No current entry"); } ZipUtil.checkRequestedFeatures(entry.entry); entry.hasWritten = true; int length; while ((length = src.read(copyBuffer)) >= 0 ) { streamCompressor.writeCounted(copyBuffer, 0, length); count( length ); } }
final int dataLen = data.limit() - data.position(); writeCounted(ZipShort.getBytes(dataLen)); streamCompressor.writeCounted(data.array(), data.arrayOffset(), dataLen);
/** * Write bytes to output or random access file. * @param data the byte array to write * @throws IOException on error */ private void writeCounted(final byte[] data) throws IOException { streamCompressor.writeCounted(data); }
public void writeCounted(final byte[] data) throws IOException { writeCounted(data, 0, data.length); }
void deflate() throws IOException { final int len = def.deflate(outputBuffer, 0, outputBuffer.length); if (len > 0) { writeCounted(outputBuffer, 0, len); } }
private void copyFromZipInputStream(final InputStream src) throws IOException { if (entry == null) { throw new IllegalStateException("No current entry"); } ZipUtil.checkRequestedFeatures(entry.entry); entry.hasWritten = true; int length; while ((length = src.read(copyBuffer)) >= 0 ) { streamCompressor.writeCounted(copyBuffer, 0, length); count( length ); } }
/** * Writes bytes to ZIP entry. * * @param b the byte array to write * @param offset the start position to write from * @param length the number of bytes to write * @param method the comrpession method to use * @return the number of bytes written to the stream this time * @throws IOException on error */ long write(final byte[] b, final int offset, final int length, final int method) throws IOException { final long current = writtenToOutputStreamForLastEntry; crc.update(b, offset, length); if (method == ZipEntry.DEFLATED) { writeDeflated(b, offset, length); } else { writeCounted(b, offset, length); } sourcePayloadLength += length; return writtenToOutputStreamForLastEntry - current; }
final int dataLen = data.limit() - data.position(); writeCounted(ZipShort.getBytes(dataLen)); streamCompressor.writeCounted(data.array(), data.arrayOffset(), dataLen);