Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.api
Interface Binary

All Superinterfaces:
  Binary

    public interface Binary

extends Binary

An extension of the standard `Binary` interface, with methods to obtain the SHA-1 hash of the binary value.

Method Summary
`byte[]` | `getHash()` Get the SHA-1 hash of the contents.
`String` | `getHexHash()` Get the hexadecimal form of the SHA-1 hash of the contents.

Methods inherited from interface javax.jcr.Binary
`dispose, getSize, getStream, read`

Method Detail

### getHash

    byte[] getHash()

  Get the SHA-1 hash of the contents. This hash can be used to determine whether two Binary instances contain the same content.

  Repeatedly calling this method should generally be efficient, as it most implementations will compute the hash only once.

  Returns:
    the hash of the contents as a byte array, or an empty array if the hash could not be computed.
  See Also:
    `MessageDigest.digest(byte[])`, `MessageDigest.getInstance(String)`, `getHexHash()`

### getHexHash

    String getHexHash()

  Get the hexadecimal form of the SHA-1 hash of the contents. This hash can be used to determine whether two Binary instances contain the same content.

  Repeatedly calling this method should generally be efficient, as it most implementations will compute the hash only once.

  Returns:
    the hexadecimal form of the `getHash()`, or a null string if the hash could not be computed or is not known
  See Also:
    `MessageDigest.digest(byte[])`, `MessageDigest.getInstance(String)`, `getHash()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.