@Override public Hasher putByte(byte b) { for (Hasher hasher : hashers) { hasher.putByte(b); } return this; }
.newHasher() .putBytes(StringUtils.toUtf8(sequenceName)) .putByte((byte) 0xff) .putBytes(StringUtils.toUtf8(previousSegmentIdNotNull)) .hash()
public StatisticsHasher putByte(byte value) { hasher.putByte(value); return this; }
.newHasher() .putBytes(StringUtils.toUtf8(sequenceName)) .putByte((byte) 0xff) .putLong(interval.getStartMillis()) .putLong(interval.getEndMillis())
@Override public void write(int b) throws IOException { hasher.putByte((byte) b); out.write(b); }
@Override public Hasher putByte(byte b) { for (Hasher hasher : hashers) { hasher.putByte(b); } return this; }
@Override public Hasher putByte(byte b) { for (Hasher hasher : hashers) { hasher.putByte(b); } return this; }
@Override public void write(int b) throws IOException { hasher.putByte((byte) b); out.write(b); }
/** * Reads the next byte of data from the underlying input stream and updates the hasher with the * byte read. */ @Override @CanIgnoreReturnValue public int read() throws IOException { int b = in.read(); if (b != -1) { hasher.putByte((byte) b); } return b; }
@Override public void write(int b) throws IOException { hasher.putByte((byte) b); out.write(b); }
/** * Reads the next byte of data from the underlying input stream and updates the hasher with the * byte read. */ @Override @CanIgnoreReturnValue public int read() throws IOException { int b = in.read(); if (b != -1) { hasher.putByte((byte) b); } return b; }
/** * Reads the next byte of data from the underlying input stream and updates the hasher with the * byte read. */ @Override @CanIgnoreReturnValue public int read() throws IOException { int b = in.read(); if (b != -1) { hasher.putByte((byte) b); } return b; }
@Override public void update(int b) { hasher.putByte((byte) b); }
@Override public void update(int b) { hasher.putByte((byte)b); }
private static HashCode getHash(final ByteBuffer byteBuffer) { Hasher hasher = hashFunction.newHasher(); while (byteBuffer.position() < byteBuffer.limit()) { hasher.putByte(byteBuffer.get()); } return hasher.hash(); }
public void testHashIntVsForLoop() { int input = 42; HashCode expected = Hashing.md5().hashInt(input); Hasher hasher = Hashing.md5().newHasher(); for (int i = 0; i < 32; i += 8) { hasher.putByte((byte) (input >> i)); } HashCode actual = hasher.hash(); assertEquals(expected, actual); }
public void testWrite_putSingleByte() throws Exception { int b = 'q'; HashingOutputStream out = new HashingOutputStream(hashFunction, buffer); out.write(b); verify(hashFunction).newHasher(); verify(hasher).putByte((byte) b); verifyNoMoreInteractions(hashFunction, hasher); }
static void hashRow( ColumnSelectorPlus<CardinalityAggregatorColumnSelectorStrategy>[] selectorPluses, HyperLogLogCollector collector ) { final Hasher hasher = hashFn.newHasher(); for (int k = 0; k < selectorPluses.length; ++k) { if (k != 0) { hasher.putByte((byte) 0); } ColumnSelectorPlus<CardinalityAggregatorColumnSelectorStrategy> selectorPlus = selectorPluses[k]; selectorPlus.getColumnSelectorStrategy().hashRow(selectorPlus.getSelector(), hasher); } collector.add(hasher.hash().asBytes()); }
public void testRead_putSingleByte() throws Exception { HashingInputStream in = new HashingInputStream(hashFunction, buffer); int b = in.read(); assertEquals('y', b); verify(hasher).putByte((byte) 'y'); verify(hashFunction).newHasher(); verifyNoMoreInteractions(hashFunction, hasher); }