Class AbstractWritableBlob

    • Constructor Detail

      • AbstractWritableBlob

        public AbstractWritableBlob()
    • Method Detail

      • readFrom

        public long readFrom​(InputStream in)
                      throws StreamCopyException
        Description copied from interface: WritableBlob
        Read data from the given input stream and write it to the blob.

        A call to this method has the same effect as requesting an output stream using WritableBlob.getOutputStream() and copying the data from the input stream to that output stream, but the implementation may achieve this result in a more efficient way.

        The blob must be in state NEW when this method is called. It will be in state COMMITTED after this method completes successfully.

        The method transfers data from the input stream to the blob until the end of the input stream is reached.

        Specified by:
        readFrom in interface WritableBlob
        Parameters:
        in - An input stream to read data from. This method will not close the stream.
        Returns:
        the number of bytes transferred
        Throws:
        StreamCopyException
      • writeTo

        public void writeTo​(OutputStream out)
                     throws StreamCopyException
        Description copied from interface: Blob
        Write the data to a given output stream. This method can be called multiple times, i.e. it doesn't consume the content.
        Specified by:
        writeTo in interface Blob
        Parameters:
        out - The output stream to write the data to. This method will not close the stream.
        Throws:
        StreamCopyException - Thrown if there is an I/O when reading the data from the blob or when writing it to the stream. StreamCopyException.getOperation() can be used to determine whether the failed operation was a read or a write.