org.modeshape.jcr.value.binary

## Class ExternalBinaryValue

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

- All Implemented Interfaces:
    Serializable, Comparable<BinaryValue>, Binary, BinaryValue
  Direct Known Subclasses:
    GitBinaryValue, UrlBinaryValue

      public abstract class ExternalBinaryValue
      extends AbstractBinary

  `BinaryValue` implementation that represents a binary value that resides outside of ModeShape's binary store. Typically this will be subclasses by `Connector` implementations that wish to provide their own binaries
  See Also:
    Serialized Form

- - ### Field Summary

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

      `EMPTY_CONTENT`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ExternalBinaryValue(BinaryKey key, String sourceName, String id, long size, String nameHint, MimeTypeDetector mimeTypeDetector)` Creates a new instance, with the given params

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getId()` Returns this binary's source-specific identifier.
    `String` | `getMimeType()`
    `String` | `getMimeType(String name)`
    `long` | `getSize()` Get the length of this binary data.
    `String` | `getSourceName()` Returns the name of the external source, to which this binary belongs.
    `protected boolean` | `hasMimeType()`
    `protected void` | `setMimeType(String mimeType)`
    `String` | `toString()`

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

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

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

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

    - ### Methods inherited from interface javax.jcr.Binary

      `getStream`

- - ### Constructor Detail

    - #### ExternalBinaryValue

          protected ExternalBinaryValue(BinaryKey key,
                             String sourceName,
                             String id,
                             long size,
                             String nameHint,
                             MimeTypeDetector mimeTypeDetector)

      Creates a new instance, with the given params
      Parameters:
        `key` - the binary key, never `null`
        `sourceName` - name of the external source which owns the value, `never null`
        `id` - the source-specific identifier of the binary, never `null`
        `size` - the length of the binary
        `nameHint` - optional name which can help with mime-type detection
        `mimeTypeDetector` - the repository's `MimeTypeDetector`

  - ### Method Detail

    - #### getId

          public String getId()

      Returns this binary's source-specific identifier.
      Returns:
        a non-null string

    - #### getSourceName

          public String getSourceName()

      Returns the name of the external source, to which this binary belongs.
      Returns:
        a non-null string

    - #### setMimeType

          protected void setMimeType(String mimeType)

    - #### hasMimeType

          protected boolean hasMimeType()

    - #### getMimeType

          public String getMimeType()

    - #### getMimeType

          public String getMimeType(String name)

    - #### getSize

          public long getSize()

      Description copied from interface: `BinaryValue`
      Get the length of this binary data.

      Note that this method, unlike the standard `Binary.getSize()` method, does not throw an exception.

      Returns:
        the number of bytes in this binary data

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AbstractBinary`

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