@Test public void checkMD5() throws Exception { byte[] expected = {(byte)0xA6, 0x3C, (byte)0x90, (byte)0xCC, 0x36, (byte)0x84, (byte)0xAD, (byte)0x8B, 0x0A, 0x21, (byte)0x76, (byte)0xA6, (byte)0xA8, (byte)0xFE, (byte)0x90, (byte)0x05}; byte[] md5 = this.cache.load(10L); assertArrayEquals("MD5 mismatch", expected, md5); }
@Override public byte[] load(final Long key) throws Exception { checkNotNull(key); _logger.debug("Loading md5 digest for size [{}]", key); final HashingInputStream hashStream = new HashingInputStream(Hashing.md5(), Streams.create(Bodies.zeroes(key))); final byte[] buffer = new byte[4096]; while (hashStream.read(buffer) != -1) { } hashStream.close(); return hashStream.hash().asBytes(); }
MD5DigestLoader extends CacheLoader<Long, byte[]> { @Override public byte[] load(final Long key) throws Exception { checkNotNull(key); _logger.debug("Loading md5 digest for size [{}]", key); final HashingInputStream hashStream = new HashingInputStream(Hashing.md5(), Streams.create(Bodies.zeroes(key))); final byte[] buffer = new byte[4096]; while (hashStream.read(buffer) != -1) { } hashStream.close(); return hashStream.hash().asBytes(); } }
MD5DigestLoader extends CacheLoader<Long, byte[]> { @Override public byte[] load(final Long key) throws Exception { checkNotNull(key); _logger.debug("Loading md5 digest for size [{}]", key); final HashingInputStream hashStream = new HashingInputStream(Hashing.md5(), Streams.create(Bodies.zeroes(key))); final byte[] buffer = new byte[4096]; while (hashStream.read(buffer) != -1) { } hashStream.close(); return hashStream.hash().asBytes(); }  }
MD5DigestLoader extends CacheLoader<Long, byte[]> { @Override public byte[] load(final Long key) throws Exception { checkNotNull(key); _logger.debug("Loading md5 digest for size [{}]", key); final HashingInputStream hashStream = new HashingInputStream(Hashing.md5(), Streams.create(Bodies.zeroes(key))); final byte[] buffer = new byte[4096]; while (hashStream.read(buffer) != -1) { } hashStream.close(); return hashStream.hash().asBytes(); }  @Override byte[] load(final Long key); }
MD5DigestLoader extends CacheLoader<Long, byte[]> { @Override public byte[] load(final Long key) throws Exception { checkNotNull(key); _logger.debug("Loading md5 digest for size [{}]", key); final HashingInputStream hashStream = new HashingInputStream(Hashing.md5(), Streams.create(Bodies.zeroes(key))); final byte[] buffer = new byte[4096]; while (hashStream.read(buffer) != -1) { } hashStream.close(); return hashStream.hash().asBytes(); }  @Override byte[] load(final Long key);  }