Class BlobWrapper

    • Field Detail

      • blob

        protected final Blob blob
      • filename

        protected String filename
    • Constructor Detail

      • BlobWrapper

        public BlobWrapper​(Blob blob)
    • Method Detail

      • setFilename

        public void setFilename​(String filename)
        Specified by:
        setFilename 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
      • setDigest

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

        public InputStream getStream()
                              throws IOException
        Description copied from interface: Blob
        Gets an InputStream for the data of this blob.

        The contract of Blob is that this method can be called several times and will correctly return a new InputStream each time. In other words, several reads of the Blob can be done.

        Like all InputStream, the result must be closed when done with it to avoid resource leaks.

        Specified by:
        getStream in interface Blob
        Returns:
        the stream
        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
      • 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
      • 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