throws IOException checkNotNull(source, "source is null"); checkNotNull(dest, "dest is null");
throws IOException checkNotNull(source, "source is null"); checkNotNull(dest, "dest is null");
public SnappyFramedOutputStream(OutputStream out, boolean writeChecksums, int blockSize, double minCompressionRatio) throws IOException { this.out = SnappyInternalUtils.checkNotNull(out, "out is null"); this.writeChecksums = writeChecksums; SnappyInternalUtils.checkArgument(minCompressionRatio > 0 && minCompressionRatio <= 1.0, "minCompressionRatio %1s must be between (0,1.0].", minCompressionRatio); this.minCompressionRatio = minCompressionRatio; this.blockSize = blockSize; this.buffer = new byte[blockSize]; this.outputBuffer = new byte[compressor.maxCompressedLength(blockSize)]; out.write(SnappyFramed.HEADER_BYTES); SnappyInternalUtils.checkArgument(blockSize > 0 && blockSize <= MAX_BLOCK_SIZE, "blockSize must be in (0, 65536]", blockSize); }
public SnappyFramedOutputStream(OutputStream out, boolean writeChecksums, int blockSize, double minCompressionRatio) throws IOException { this.out = SnappyInternalUtils.checkNotNull(out, "out is null"); this.writeChecksums = writeChecksums; SnappyInternalUtils.checkArgument(minCompressionRatio > 0 && minCompressionRatio <= 1.0, "minCompressionRatio %1s must be between (0,1.0].", minCompressionRatio); this.minCompressionRatio = minCompressionRatio; this.blockSize = blockSize; this.buffer = new byte[blockSize]; this.outputBuffer = new byte[compressor.maxCompressedLength(blockSize)]; out.write(SnappyFramed.HEADER_BYTES); SnappyInternalUtils.checkArgument(blockSize > 0 && blockSize <= MAX_BLOCK_SIZE, "blockSize must be in (0, 65536]", blockSize); }
@Override public int read(byte[] output, int offset, int length) throws IOException { SnappyInternalUtils.checkNotNull(output, "output is null"); SnappyInternalUtils.checkPositionIndexes(offset, offset + length, output.length); if (closed) { throw new IOException("Stream is closed"); } if (length == 0) { return 0; } if (!ensureBuffer()) { return -1; } int size = min(length, available()); System.arraycopy(buffer, position, output, offset, size); position += size; return size; }
@Override public int read(byte[] output, int offset, int length) throws IOException { SnappyInternalUtils.checkNotNull(output, "output is null"); SnappyInternalUtils.checkPositionIndexes(offset, offset + length, output.length); if (closed) { throw new IOException("Stream is closed"); } if (length == 0) { return 0; } if (!ensureBuffer()) { return -1; } int size = min(length, available()); System.arraycopy(buffer, position, output, offset, size); position += size; return size; }
throws IOException SnappyInternalUtils.checkNotNull(input, "input is null"); SnappyInternalUtils.checkPositionIndexes(offset, offset + length, input.length); if (closed) {
throws IOException SnappyInternalUtils.checkNotNull(input, "input is null"); SnappyInternalUtils.checkPositionIndexes(offset, offset + length, input.length); if (closed) {