public interface WritableBlob extends Blob
The behavior of the methods defined by this interface is described in terms of four logical states the blob can be in:
Blobinterface will throw
IllegalStateExceptionif the blob is not in state COMMITTED.
|Modifier and Type||Method and Description|
Create an output stream to write data to the blob.
Read data from the given input stream and write it to the blob.
Release all resources held by this blob.
OutputStream getOutputStream() throws IOException
Calls to methods of the returned output stream will modify the state of the blob according to the following rules:
OutputStream.close()will change the state to COMMITTED.
IOExceptionif the state is COMMITTED, i.e. if the stream has already been closed.
The returned stream may implement
ReadFromSupport, especially if the blob stores its
data in memory (in which case
ReadFromSupport.readFrom(InputStream, long) would read
data directly into the buffers managed by the blob).
long readFrom(InputStream in) throws StreamCopyException
A call to this method has the same effect as requesting an output stream using
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 UNCOMMITTED 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.
Copyright © The Apache Software Foundation. All Rights Reserved.