Class PartDataHandlerBlob

java.lang.Object
org.apache.axiom.mime.activation.PartDataHandlerBlob
All Implemented Interfaces:
Blob, PartBlob

public final class PartDataHandlerBlob extends Object implements PartBlob
PartBlob implementation that wraps a PartDataHandler.
  • Method Details

    • getDataHandler

      public PartDataHandler getDataHandler()
    • getPart

      public Part getPart()
      Description copied from interface: PartBlob
      The the MIME part from which this blob was created.
      Specified by:
      getPart in interface PartBlob
      Returns:
      the MIME part
    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: Blob
      Get an input stream to read the data in the blob. A new InputStream object is returned each time this method is called, and the stream is positioned at the beginning of the data.
      Specified by:
      getInputStream in interface Blob
      Returns:
      the input stream to read the data from
      Throws:
      IOException
    • writeTo

      public void writeTo(OutputStream out) throws org.apache.axiom.ext.io.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:
      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.
    • getSize

      public long getSize()
      Description copied from interface: Blob
      Get the (approximate) size of the blob. Returns -1 if the size can't be determined without reading the entire blob (in which case the caller may want to use Blob.writeTo(OutputStream) with an OutputStream that counts the number of bytes to determine the size). The method may choose to return a value based on an estimation. This may be the case e.g. if reading the data involves a decoding operation, and the length of the resulting stream can't be determined precisely without performing the decoding operation.

      When reading the actual data, the code should always read until the end of the stream is reached (as indicated by the return value of the read methods of the InputStream class). It must be prepared to reach the end of the stream after a number of bytes that is lower or higher than the value returned by this method.

      Specified by:
      getSize in interface Blob
      Returns:
      the number of bytes in the blob, or -1 if the size is not known