Interface Blob

  • All Known Implementing Classes:
    AbstractBlob, ArrayBasedBlob, BinaryBasedBlob, BlobStoreBlob, StringBasedBlob

    public interface Blob
    Immutable representation of a binary value of finite length.

    Two blobs are considered equal in terms of Object.equals(Object) if they contain the same sequences of bytes. Implementations can optimize the equality checks by using strong hash codes or other similar means as long as they comply with the above definition of equality.

    Due to their nature blobs should not be used as keys in hash tables. To highlight that and to ensure semantic correctness of the equality contract across different blob implementations, the Object.hashCode() method of all blob instances should return zero.

    • Method Detail

      • getNewStream

        @NotNull
        @NotNull InputStream getNewStream()
        Returns a new stream for this blob. The streams returned from multiple calls to this method are byte wise equals. That is, subsequent calls to read return the same sequence of bytes as long as neither call throws an exception.
        Returns:
        a new stream for this blob
      • length

        long length()
        Returns the length of this blob or -1 if unknown.
        Returns:
        the length of this blob.
      • getReference

        @Nullable
        @Nullable String getReference()
        Returns a secure reference to this blob, or null if such a reference is not available.
        Returns:
        binary reference, or null
        See Also:
        OAK-834
      • getContentIdentity

        @Nullable
        @Nullable String getContentIdentity()
        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.

        Returns:
        the unique identifier or null
      • isInlined

        default boolean isInlined()
        Checks if the external blob is inlined in the id itself
        Returns: