Class BinaryBasedBlob

  • All Implemented Interfaces:
    Blob

    public class BinaryBasedBlob
    extends java.lang.Object
    implements Blob
    This Blob implementation is based on an underlying Binary.

    Any error accessing the underlying binary in getNewStream() will be deferred to the returned input stream.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getContentIdentity()
      A unique identifier of the content of this value.
      @NotNull java.io.InputStream getNewStream()
      Delegates to Binary.getStream() and returns an input stream the always throws an IOException if the underlying binary failed to produce one.
      java.lang.String getReference()
      Returns a secure reference to this blob, or null if such a reference is not available.
      long length()
      Delegates to Binary.getSize() and returns -1 if that fails.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.jackrabbit.oak.api.Blob

        isInlined
    • Constructor Detail

      • BinaryBasedBlob

        public BinaryBasedBlob​(Binary binary)
    • Method Detail

      • getNewStream

        @NotNull
        public @NotNull java.io.InputStream getNewStream()
        Delegates to Binary.getStream() and returns an input stream the always throws an IOException if the underlying binary failed to produce one.
        Specified by:
        getNewStream in interface Blob
        Returns:
        a new stream for this blob
      • length

        public long length()
        Delegates to Binary.getSize() and returns -1 if that fails.
        Specified by:
        length in interface Blob
        Returns:
        the length of this blob.
      • getReference

        public java.lang.String getReference()
        Description copied from interface: Blob
        Returns a secure reference to this blob, or null if such a reference is not available.
        Specified by:
        getReference in interface Blob
        Returns:
        null
        See Also:
        OAK-834
      • getContentIdentity

        public java.lang.String getContentIdentity()
        Description copied from interface: Blob
        A unique identifier of the content of this value. Usually this is a message digest of the content (a cryptographically secure one-way hash). This allows to avoid processing large binary values multiple times.

        This method returns null if the identifier is unknown. The identifier may not always be available, for example if the value has not yet been saved or processed. Once an identifier is available, it will never change because values are immutable.

        If two values have the same identifier, the content of the value is guaranteed to be the same. However it is not guaranteed that two values with the same content will return the same identifier.

        The identifier is opaque, meaning it can have any format and size.

        Specified by:
        getContentIdentity in interface Blob
        Returns:
        null