Examples of asBytes()


Examples of com.google.common.hash.HashCode.asBytes()

        byte[] data = randomBytes(131);

        HashCode expected = Hashing.murmur3_128().hashBytes(data);
        Slice actual = Murmur3.hash(Slices.wrappedBuffer(data));

        assertEquals(actual.getBytes(), expected.asBytes());
    }

    @Test(invocationCount = 100)
    public void testOffsetAndLength()
            throws Exception
View Full Code Here

Examples of com.google.common.hash.HashCode.asBytes()

        int length = 55;

        HashCode expected = Hashing.murmur3_128().hashBytes(data, offset, length);
        Slice actual = Murmur3.hash(Slices.wrappedBuffer(data), offset, length);

        assertEquals(actual.getBytes(), expected.asBytes());
    }

    @Test(invocationCount = 100)
    public void testNonDefaultSeed()
            throws Exception
View Full Code Here

Examples of com.google.common.hash.HashCode.asBytes()

        int seed = 123456789;

        HashCode expected = Hashing.murmur3_128(seed).hashBytes(data);
        Slice actual = Murmur3.hash(seed, Slices.wrappedBuffer(data), 0, data.length);

        assertEquals(actual.getBytes(), expected.asBytes());
    }

    @Test
    public void testTail()
            throws Exception
View Full Code Here

Examples of com.google.common.hash.HashCode.asBytes()

            byte[] data = randomBytes(50 + i);

            HashCode expected = Hashing.murmur3_128().hashBytes(data);
            Slice actual = Murmur3.hash(Slices.wrappedBuffer(data));

            assertEquals(actual.getBytes(), expected.asBytes());
        }
    }

    @Test(invocationCount = 100)
    public void testLessThan16Bytes64()
View Full Code Here

Examples of com.google.common.hash.HashCode.asBytes()

            HashCode hc1 = it.next();
            if (it.hasNext()) {
                HashCode hc2 = it.next();
                result.add(Hashing.sha256().newHasher()
                      .putBytes(hc1.asBytes())
                      .putBytes(hc2.asBytes())
                      .hash());
            } else {
               result.add(hc1);
            }
         }
View Full Code Here

Examples of com.google.common.hash.HashCode.asBytes()

      String containerName = getContainerName();
      S3Object object = null;
      try {
         String key = "constitution.txt";
         String uploadId = getApi().initiateMultipartUpload(containerName,
                  ObjectMetadataBuilder.create().key(key).contentMD5(oneHundredOneConstitutionsMD5.asBytes()).build());
         byte[] buffer = oneHundredOneConstitutions.read();
         assertEquals(oneHundredOneConstitutions.size(), (long) buffer.length);

         Payload part1 = newByteArrayPayload(buffer);
         part1.getContentMetadata().setContentLength((long) buffer.length);
View Full Code Here

Examples of com.google.common.hash.HashCode.asBytes()

     * @return the {@code ObjectId} generated from the string
     */
    public static ObjectId forString(final String strToHash) {
        Preconditions.checkNotNull(strToHash);
        HashCode hashCode = HASH_FUNCTION.hashString(strToHash, Charset.forName("UTF-8"));
        return new ObjectId(hashCode.asBytes(), false);
    }

    /**
     * Returns the value of this ObjectId's internal hash at the given index without having to go
     * through {@link #getRawValue()} and hence create excessive defensive copies of the byte array.
View Full Code Here

Examples of com.workingdogs.village.Value.asBytes()

                    {
                        obj2 = value.asBigDecimal();
                    }
                    if (value.isBytes())
                    {
                        obj2 = value.asBytes();
                    }
                    if (value.isDate())
                    {
                        obj2 = value.asDate();
                    }
View Full Code Here

Examples of com.workingdogs.village.Value.asBytes()

            {
                Object obj2 = null;
                Value value = row.getValue(j+1);
                if (value.isByte()) obj2 = new Byte(value.asByte());
                if (value.isBigDecimal()) obj2 = value.asBigDecimal();
                if (value.isBytes()) obj2 = value.asBytes();
                if (value.isDate()) obj2 = value.asDate();
                if (value.isShort()) obj2 = new Short(value.asShort());
                if (value.isInt()) obj2 = new Integer(value.asInt());
                if (value.isLong()) obj2 = new Long(value.asLong());
                if (value.isDouble()) obj2 = new Double(value.asDouble());
View Full Code Here

Examples of com.workingdogs.village.Value.asBytes()

                if (value.isString())
                    obj2 = value.asString();
                else if (value.isBigDecimal())
                    obj2 = value.asBigDecimal();
                else if (value.isBytes())
                    obj2 = value.asBytes();
                else if (value.isDate())
                    obj2 = value.asDate();
                else if (value.isShort())
                    obj2 = new Short(value.asShort());
                else if (value.isInt())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.