Class AbstractBlob

java.lang.Object
org.nuxeo.ecm.core.api.impl.blob.AbstractBlob
All Implemented Interfaces:
Serializable, Blob
Direct Known Subclasses:
BinaryBlob, ByteArrayBlob, FileBlob, SimpleManagedBlob, StringBlob, URLBlob, ZipEntryBlob

public abstract class AbstractBlob extends Object implements Blob, Serializable
Abstract implementation of a Blob storing the information other than the byte stream.
See Also:
  • Field Details

  • Constructor Details

    • AbstractBlob

      public AbstractBlob()
  • Method Details

    • getMimeType

      public String getMimeType()
      Specified by:
      getMimeType in interface Blob
    • getEncoding

      public String getEncoding()
      Specified by:
      getEncoding in interface Blob
    • getFilename

      public String getFilename()
      Specified by:
      getFilename in interface Blob
    • getDigestAlgorithm

      public String getDigestAlgorithm()
      Specified by:
      getDigestAlgorithm in interface Blob
    • getDigest

      public String getDigest()
      Specified by:
      getDigest in interface Blob
    • setMimeType

      public void setMimeType(String mimeType)
      Specified by:
      setMimeType in interface Blob
    • setEncoding

      public void setEncoding(String encoding)
      Specified by:
      setEncoding in interface Blob
    • setFilename

      public void setFilename(String filename)
      Specified by:
      setFilename in interface Blob
    • setDigestAlgorithm

      public void setDigestAlgorithm(String digestAlgorithm)
      Specified by:
      setDigestAlgorithm in interface Blob
    • setDigest

      public void setDigest(String digest)
      Specified by:
      setDigest in interface Blob
    • getFile

      public File getFile()
      Description copied from interface: Blob
      If this blob is backed by an actual file, returns it.

      The returned file may be short-lived (temporary), so should be used immediately.

      Specified by:
      getFile in interface Blob
      Returns:
      a file, or null if the blob is not backed by a file
    • getByteArray

      public byte[] getByteArray() throws IOException
      Specified by:
      getByteArray in interface Blob
      Throws:
      IOException
    • getString

      public String getString() throws IOException
      Specified by:
      getString in interface Blob
      Throws:
      IOException
    • getLength

      public long getLength()
      Description copied from interface: Blob
      Gets the data length in bytes if known.
      Specified by:
      getLength in interface Blob
      Returns:
      the data length or -1 if not known
    • getCloseableFile

      public CloseableFile getCloseableFile() throws IOException
      Description copied from interface: Blob
      Gets a CloseableFile backing this blob, which must be closed when done by the caller.

      The returned file may be the original file, a temporary file, or a symbolic link.

      Specified by:
      getCloseableFile in interface Blob
      Returns:
      a closeable file, to be closed when done
      Throws:
      IOException
    • getCloseableFile

      public CloseableFile getCloseableFile(String ext) throws IOException
      Description copied from interface: Blob
      Gets a CloseableFile backing this blob, which must be closed when done by the caller.

      The returned file may be the original file, a temporary file, or a symbolic link.

      Specified by:
      getCloseableFile in interface Blob
      Parameters:
      ext - the required extension for the file, or null if it doesn't matter
      Returns:
      a closeable file, to be closed when done
      Throws:
      IOException
    • transferTo

      public void transferTo(OutputStream out) throws IOException
      Specified by:
      transferTo in interface Blob
      Throws:
      IOException
    • transferTo

      public void transferTo(File file) throws IOException
      Specified by:
      transferTo in interface Blob
      Throws:
      IOException
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • equalsStream

      protected boolean equalsStream(Blob other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object