/** * Computes the CRC32C checksum of the supplied data and performs the "mask" operation * on the computed checksum * * @param data The input data to calculate the CRC32C checksum of */ static int calculateChecksum(ByteBuf data) { return calculateChecksum(data, data.readerIndex(), data.readableBytes()); }
/** * Computes the CRC32C checksum of the supplied data and performs the "mask" operation * on the computed checksum * * @param data The input data to calculate the CRC32C checksum of */ static int calculateChecksum(ByteBuf data) { return calculateChecksum(data, data.readerIndex(), data.readableBytes()); }
/** * Calculates and writes the 4-byte checksum to the output buffer * * @param slice The data to calculate the checksum for * @param out The output buffer to write the checksum to */ private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) { out.writeIntLE(calculateChecksum(slice)); } }
/** * Computes the CRC32C checksum of the supplied data and performs the "mask" operation * on the computed checksum * * @param data The input data to calculate the CRC32C checksum of */ static int calculateChecksum(ByteBuf data) { return calculateChecksum(data, data.readerIndex(), data.readableBytes()); }
/** * Computes the CRC32C checksum of the supplied data, performs the "mask" operation * on the computed checksum, and then compares the resulting masked checksum to the * supplied checksum. * * @param expectedChecksum The checksum decoded from the stream to compare against * @param data The input data to calculate the CRC32C checksum of * @throws DecompressionException If the calculated and supplied checksums do not match */ static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
/** * Calculates and writes the 4-byte checksum to the output buffer * * @param slice The data to calculate the checksum for * @param out The output buffer to write the checksum to */ private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) { out.writeIntLE(calculateChecksum(slice)); } }
/** * Calculates and writes the 4-byte checksum to the output buffer * * @param slice The data to calculate the checksum for * @param out The output buffer to write the checksum to */ private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) { out.writeIntLE(calculateChecksum(slice)); } }
/** * Computes the CRC32C checksum of the supplied data, performs the "mask" operation * on the computed checksum, and then compares the resulting masked checksum to the * supplied checksum. * * @param expectedChecksum The checksum decoded from the stream to compare against * @param data The input data to calculate the CRC32C checksum of * @throws DecompressionException If the calculated and supplied checksums do not match */ static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
/** * Computes the CRC32C checksum of the supplied data, performs the "mask" operation * on the computed checksum, and then compares the resulting masked checksum to the * supplied checksum. * * @param expectedChecksum The checksum decoded from the stream to compare against * @param data The input data to calculate the CRC32C checksum of * @throws DecompressionException If the calculated and supplied checksums do not match */ static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
/** * Computes the CRC32C checksum of the supplied data and performs the "mask" operation * on the computed checksum * * @param data The input data to calculate the CRC32C checksum of */ static int calculateChecksum(ByteBuf data) { return calculateChecksum(data, data.readerIndex(), data.readableBytes()); }
/** * Computes the CRC32C checksum of the supplied data and performs the "mask" operation * on the computed checksum * * @param data The input data to calculate the CRC32C checksum of */ static int calculateChecksum(ByteBuf data) { return calculateChecksum(data, data.readerIndex(), data.readableBytes()); }
/** * Computes the CRC32C checksum of the supplied data and performs the "mask" operation * on the computed checksum * * @param data The input data to calculate the CRC32C checksum of */ static int calculateChecksum(ByteBuf data) { return calculateChecksum(data, data.readerIndex(), data.readableBytes()); }
/** * Computes the CRC32C checksum of the supplied data and performs the "mask" operation * on the computed checksum * * @param data The input data to calculate the CRC32C checksum of */ static int calculateChecksum(ByteBuf data) { return calculateChecksum(data, data.readerIndex(), data.readableBytes()); }
/** * Calculates and writes the 4-byte checksum to the output buffer * * @param slice The data to calculate the checksum for * @param out The output buffer to write the checksum to */ private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) { out.writeIntLE(calculateChecksum(slice)); } }
/** * Calculates and writes the 4-byte checksum to the output buffer * * @param slice The data to calculate the checksum for * @param out The output buffer to write the checksum to */ private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) { out.writeIntLE(calculateChecksum(slice)); } }
/** * Calculates and writes the 4-byte checksum to the output buffer * * @param slice The data to calculate the checksum for * @param out The output buffer to write the checksum to */ private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) { out.writeIntLE(calculateChecksum(slice)); } }
/** * Calculates and writes the 4-byte checksum to the output buffer * * @param slice The data to calculate the checksum for * @param out The output buffer to write the checksum to */ private static void calculateAndWriteChecksum(ByteBuf slice, ByteBuf out) { out.writeIntLE(calculateChecksum(slice)); } }
/** * Computes the CRC32C checksum of the supplied data, performs the "mask" operation * on the computed checksum, and then compares the resulting masked checksum to the * supplied checksum. * * @param expectedChecksum The checksum decoded from the stream to compare against * @param data The input data to calculate the CRC32C checksum of * @throws DecompressionException If the calculated and supplied checksums do not match */ static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
/** * Computes the CRC32C checksum of the supplied data, performs the "mask" operation * on the computed checksum, and then compares the resulting masked checksum to the * supplied checksum. * * @param expectedChecksum The checksum decoded from the stream to compare against * @param data The input data to calculate the CRC32C checksum of * @throws DecompressionException If the calculated and supplied checksums do not match */ static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
/** * Computes the CRC32C checksum of the supplied data, performs the "mask" operation * on the computed checksum, and then compares the resulting masked checksum to the * supplied checksum. * * @param expectedChecksum The checksum decoded from the stream to compare against * @param data The input data to calculate the CRC32C checksum of * @throws DecompressionException If the calculated and supplied checksums do not match */ static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }