@Test public void simpleUnwrap() { assertEquals( DigestUtil.calculateCrc16(new byte[]{47}), DigestUtil.calculateCrc16(() -> Unpooled.wrappedBuffer(new byte[]{47}))); }
public static int calculateCrc16(ByteReadable... byteReadables) { if (byteReadables.length == 1) { return calculateCrc16(byteReadables[0].getBytes()); } long currentCrcValue = crc.init(); for (ByteReadable byteReadable : byteReadables) { currentCrcValue = crc.update(currentCrcValue, byteReadable.getBytes()); } short finalCrc = crc.finalCRC16(currentCrcValue); return Short.toUnsignedInt(Short.reverseBytes(finalCrc)); }
DigestUtil { public static int calculateCrc16(ByteReadable... byteReadables) { if (byteReadables.length == 1) { return calculateCrc16(byteReadables[0].getBytes()); } long currentCrcValue = crc.init(); for (ByteReadable byteReadable : byteReadables) { currentCrcValue = crc.update(currentCrcValue, byteReadable.getBytes()); } short finalCrc = crc.finalCRC16(currentCrcValue); return Short.toUnsignedInt(Short.reverseBytes(finalCrc)); } }
DigestUtil { public static int calculateCrc16(ByteReadable... byteReadables) { if (byteReadables.length == 1) { return calculateCrc16(byteReadables[0].getBytes()); } long currentCrcValue = crc.init(); for (ByteReadable byteReadable : byteReadables) { currentCrcValue = crc.update(currentCrcValue, byteReadable.getBytes()); } short finalCrc = crc.finalCRC16(currentCrcValue); return Short.toUnsignedInt(Short.reverseBytes(finalCrc)); } private  DigestUtil(); }
DigestUtil { public static int calculateCrc16(ByteReadable... byteReadables) { if (byteReadables.length == 1) { return calculateCrc16(byteReadables[0].getBytes()); } long currentCrcValue = crc.init(); for (ByteReadable byteReadable : byteReadables) { currentCrcValue = crc.update(currentCrcValue, byteReadable.getBytes()); } short finalCrc = crc.finalCRC16(currentCrcValue); return Short.toUnsignedInt(Short.reverseBytes(finalCrc)); } private  DigestUtil(); static int calculateCrc16(ByteReadable... byteReadables); static int calculateCrc16(byte[] bytes); }
DigestUtil { public static int calculateCrc16(ByteReadable... byteReadables) { if (byteReadables.length == 1) { return calculateCrc16(byteReadables[0].getBytes()); } long currentCrcValue = crc.init(); for (ByteReadable byteReadable : byteReadables) { currentCrcValue = crc.update(currentCrcValue, byteReadable.getBytes()); } short finalCrc = crc.finalCRC16(currentCrcValue); return Short.toUnsignedInt(Short.reverseBytes(finalCrc)); } private  DigestUtil(); static int calculateCrc16(ByteReadable... byteReadables); static int calculateCrc16(byte[] bytes); static final CRC.Parameters CRC16; static final CRC.Parameters CRC16_ADS; }