Package org.apache.axiom.blob
Class AbstractWritableBlob
java.lang.Object
org.apache.axiom.blob.AbstractWritableBlob
- All Implemented Interfaces:
Blob,WritableBlob
Partial implementation of the
WritableBlob interface that implements WritableBlob.readFrom(InputStream) using WritableBlob.getOutputStream() and Blob.writeTo(OutputStream) using Blob.getInputStream().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongreadFrom(InputStream in) Read data from the given input stream and write it to the blob.voidwriteTo(OutputStream out) Write the data to a given output stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.axiom.blob.Blob
getInputStream, getSizeMethods inherited from interface org.apache.axiom.blob.WritableBlob
getOutputStream, release
-
Constructor Details
-
AbstractWritableBlob
public AbstractWritableBlob()
-
-
Method Details
-
readFrom
Description copied from interface:WritableBlobRead 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:
readFromin interfaceWritableBlob- Parameters:
in- An input stream to read data from. This method will not close the stream.- Returns:
- the number of bytes transferred
- Throws:
org.apache.axiom.ext.io.StreamCopyException
-
writeTo
Description copied from interface:BlobWrite the data to a given output stream. This method can be called multiple times, i.e. it doesn't consume the content.- Specified by:
writeToin interfaceBlob- Parameters:
out- The output stream to write the data to. This method will not close the stream.- Throws:
org.apache.axiom.ext.io.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.
-