Class AbstractBlob

java.lang.Object
org.apache.jackrabbit.oak.plugins.memory.AbstractBlob
All Implemented Interfaces:
org.apache.jackrabbit.oak.api.Blob
Direct Known Subclasses:
ArrayBasedBlob, StringBasedBlob

public abstract class AbstractBlob extends Object implements org.apache.jackrabbit.oak.api.Blob
Abstract base class for Blob implementations. This base class provides default implementations for hashCode and equals.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
    protected
    AbstractBlob(org.apache.jackrabbit.guava.common.hash.HashCode hashCode)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.jackrabbit.guava.common.hash.HashCode
    calculateSha256(org.apache.jackrabbit.oak.api.Blob blob)
     
    static boolean
    equal(org.apache.jackrabbit.oak.api.Blob a, org.apache.jackrabbit.oak.api.Blob b)
     
    boolean
    equals(Object other)
    To Blob instances are considered equal iff they have the same SHA-256 hash code are equal.
     
    @Nullable String
     
    int
     
    protected byte[]
    This hash code implementation returns the hash code of the underlying stream
     

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.apache.jackrabbit.oak.api.Blob

    getNewStream, isInlined, length
  • Constructor Details

    • AbstractBlob

      protected AbstractBlob(org.apache.jackrabbit.guava.common.hash.HashCode hashCode)
    • AbstractBlob

      protected AbstractBlob()
  • Method Details

    • equal

      public static boolean equal(org.apache.jackrabbit.oak.api.Blob a, org.apache.jackrabbit.oak.api.Blob b)
    • calculateSha256

      public static org.apache.jackrabbit.guava.common.hash.HashCode calculateSha256(org.apache.jackrabbit.oak.api.Blob blob)
    • sha256

      protected byte[] sha256()
      This hash code implementation returns the hash code of the underlying stream
      Returns:
      a byte array of the hash
    • getReference

      @Nullable public @Nullable String getReference()
      Specified by:
      getReference in interface org.apache.jackrabbit.oak.api.Blob
    • getContentIdentity

      public String getContentIdentity()
      Specified by:
      getContentIdentity in interface org.apache.jackrabbit.oak.api.Blob
    • equals

      public boolean equals(Object other)
      To Blob instances are considered equal iff they have the same SHA-256 hash code are equal.
      Overrides:
      equals in class Object
      Parameters:
      other -
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object