org.modeshape.jcr.value.binary

## Class FileUrlBinaryValue

- java.lang.Object
- - org.modeshape.jcr.value.binary.AbstractBinary
  - - org.modeshape.jcr.value.binary.ExternalBinaryValue
    - - org.modeshape.jcr.value.binary.UrlBinaryValue
      - - org.modeshape.jcr.value.binary.FileUrlBinaryValue

- All Implemented Interfaces:
    Serializable, Comparable<BinaryValue>, Binary, BinaryValue

      @ThreadSafe
      public class FileUrlBinaryValue
      extends UrlBinaryValue

  A subclass of `UrlBinaryValue` to lazily compute a contentBased Hash when the key is a URI based Hash
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.modeshape.jcr.value.binary.AbstractBinary

      `EMPTY_CONTENT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileUrlBinaryValue(String sha1, String sourceName, URL content, long size, String nameHint, MimeTypeDetector mimeTypeDetector)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 class org.modeshape.jcr.value.binary.UrlBinaryValue

      `getStream, toUrl`

    - ### Methods inherited from class org.modeshape.jcr.value.binary.ExternalBinaryValue

      `getId, getMimeType, getMimeType, getSize, getSourceName, hasMimeType, setMimeType, toString`

    - ### Methods inherited from class org.modeshape.jcr.value.binary.AbstractBinary

      `compareTo, dispose, equals, getKey, getReadableSize, hashCode, keyFor, read`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FileUrlBinaryValue

          public FileUrlBinaryValue(String sha1,
                            String sourceName,
                            URL content,
                            long size,
                            String nameHint,
                            MimeTypeDetector mimeTypeDetector)

  - ### Method Detail

    - #### getHash

          public byte[] getHash()

      Description copied from interface: `Binary`
      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.

      Overrides:
        `getHash` in class `AbstractBinary`
      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)`, `Binary.getHexHash()`

    - #### getHexHash

          public String getHexHash()

      Description copied from interface: `Binary`
      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.

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

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