@Override public int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) { long inputAddress = ARRAY_BYTE_BASE_OFFSET + inputOffset; long inputLimit = inputAddress + inputLength; long outputAddress = ARRAY_BYTE_BASE_OFFSET + outputOffset; long outputLimit = outputAddress + maxOutputLength; return SnappyRawCompressor.compress(input, inputAddress, inputLimit, output, outputAddress, outputLimit, table); }
@Override public int maxCompressedLength(int uncompressedSize) { return SnappyRawCompressor.maxCompressedLength(uncompressedSize); }
int maxCompressedLength = maxCompressedLength((int) (inputLimit - inputAddress)); if (outputLimit - outputAddress < maxCompressedLength) { throw new IllegalArgumentException("Output buffer must be at least " + maxCompressedLength + " bytes"); long output = writeUncompressedLength(outputBase, outputAddress, (int) (inputLimit - inputAddress)); int blockHashTableSize = getHashTableSize((int) (blockLimit - blockAddress)); Arrays.fill(table, 0, blockHashTableSize, (short) 0); final int shift = 32 - log2Floor(blockHashTableSize); assert (blockHashTableSize & (blockHashTableSize - 1)) == 0 : "table must be power of two"; assert 0xFFFFFFFF >>> shift == blockHashTableSize - 1; int hash = hashBytes(currentInt, shift); output = emitLiteralLength(outputBase, output, literalLength); output = fastCopy(inputBase, nextEmitAddress, outputBase, output, literalLength); int matched = count(inputBase, input + SIZE_OF_INT, candidateIndex + SIZE_OF_INT, blockLimit); matched += SIZE_OF_INT; output = emitCopy(outputBase, output, input, candidateIndex, matched); input += matched; int prevHash = hashBytes(prevInt, shift); table[prevHash] = (short) (input - blockAddress - 1); int curHash = hashBytes(inputBytes, shift);
int maxCompressedLength = maxCompressedLength((int) (inputLimit - inputAddress)); if (outputLimit - outputAddress < maxCompressedLength) { throw new IllegalArgumentException("Output buffer must be at least " + maxCompressedLength + " bytes"); long output = writeUncompressedLength(outputBase, outputAddress, (int) (inputLimit - inputAddress)); int blockHashTableSize = getHashTableSize((int) (blockLimit - blockAddress)); Arrays.fill(table, 0, blockHashTableSize, (short) 0); final int shift = 32 - log2Floor(blockHashTableSize); assert (blockHashTableSize & (blockHashTableSize - 1)) == 0 : "table must be power of two"; assert 0xFFFFFFFF >>> shift == blockHashTableSize - 1; int hash = hashBytes(currentInt, shift); output = emitLiteralLength(outputBase, output, literalLength); output = fastCopy(inputBase, nextEmitAddress, outputBase, output, literalLength); int matched = count(inputBase, input + SIZE_OF_INT, candidateIndex + SIZE_OF_INT, blockLimit); matched += SIZE_OF_INT; output = emitCopy(outputBase, output, input, candidateIndex, matched); input += matched; int prevHash = hashBytes(prevInt, shift); table[prevHash] = (short) (input - blockAddress - 1); int curHash = hashBytes(inputBytes, shift);
@Override public int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) { long inputAddress = ARRAY_BYTE_BASE_OFFSET + inputOffset; long inputLimit = inputAddress + inputLength; long outputAddress = ARRAY_BYTE_BASE_OFFSET + outputOffset; long outputLimit = outputAddress + maxOutputLength; return SnappyRawCompressor.compress(input, inputAddress, inputLimit, output, outputAddress, outputLimit, table); }
@Override public int maxCompressedLength(int uncompressedSize) { return SnappyRawCompressor.maxCompressedLength(uncompressedSize); }
int written = SnappyRawCompressor.compress( inputBase, inputAddress,
int written = SnappyRawCompressor.compress( inputBase, inputAddress,