net.sf.mmm.content.value.base
Class AbstractBlob

java.lang.Object
  extended by net.sf.mmm.content.value.base.AbstractBlob
All Implemented Interfaces:
Blob, MutableBlob

public abstract class AbstractBlob
extends Object
implements MutableBlob

This is the abstract base implementation of the Blob interface.

Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
 
Fields inherited from interface net.sf.mmm.content.value.api.Blob
VALUE_NAME
 
Constructor Summary
AbstractBlob()
          The constructor.
 
Method Summary
 String getMimeType()
          This method gets the mimetype of this file.
 long getSize()
          This method gets the current size of this file.
 void streamData(OutputStream outStream)
          This method writes the data of this BLOB to the given output stream.
 void writeData(InputStream inputStream, boolean append)
          This method writes the data from the give input stream to this BLOB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.content.value.api.MutableBlob
getWriteAccess
 
Methods inherited from interface net.sf.mmm.content.value.api.Blob
getChecksum, getReadAccess, getRevision
 

Constructor Detail

AbstractBlob

public AbstractBlob()
The constructor.

Method Detail

writeData

public void writeData(InputStream inputStream,
                      boolean append)
               throws IOException
This method writes the data from the give input stream to this BLOB. The given input stream will be closed at the end.

Specified by:
writeData in interface MutableBlob
Parameters:
inputStream - is an input stream containing the data to write to this BLOB.
append - true if the data should be appended to the BLOB, false if the BLOB should be overridden.
Throws:
IOException - if the writing fails.

streamData

public void streamData(OutputStream outStream)
                throws IOException
This method writes the data of this BLOB to the given output stream. The given output stream will NOT be closed.

Specified by:
streamData in interface Blob
Parameters:
outStream - is the stream where to write the data to.
Throws:
IOException - if the streaming fails.

getSize

public long getSize()
This method gets the current size of this file.

Specified by:
getSize in interface Blob
Returns:
the file size.

getMimeType

public String getMimeType()
This method gets the mimetype of this file.

Specified by:
getMimeType in interface Blob
Returns:
the files mimetype.


Copyright © 2001-2008 mmm-Team. All Rights Reserved.