fedora.client
Class DataStream

java.lang.Object
  extended by fedora.client.DataStream
Direct Known Subclasses:
BasisDataStream, InlineDataStream

public abstract class DataStream
extends java.lang.Object

Title: DataStream.java

Description:

The model of a datastream as it exists inside the editor.

This class has getters and setters for the fields and bytes of a datastream while it is being edited.

Version:
$Id: DataStream.java 3965 2005-04-21 12:52:40Z rlw $
Author:
cwilper@cs.cornell.edu

Field Summary
static int BASIS
          Identifier for BASIS datastreams
static java.io.ByteArrayInputStream EMPTY
          Empty stream
static int INLINE
          Identifier for INLINE datastreams
protected  boolean m_dirty
          Whether this datastream is dirty
 
Constructor Summary
DataStream(java.io.File tempDir, java.lang.String id)
          Constructs a datastream with a given temporary directory to write itself to, and an identifier.
 
Method Summary
 void clearData()
           
 java.io.InputStream getData()
          Gets an InputStream to the local copy of the datastream.
 java.lang.String getId()
          Gets the id of the datastream inside the object.
 java.lang.String getMimeType()
          Gets the mime type.
 long getSize()
          Gets the size, in bytes.
abstract  int getType()
          Returns INLINE or BASIS.
 boolean isDirty()
           
 void setClean()
           
 void setData(java.io.InputStream in)
          Reads the bytes from the given InputStream as the data for this digital object.
 void setMimeType(java.lang.String mimeType)
          Sets the mime type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final java.io.ByteArrayInputStream EMPTY
Empty stream


INLINE

public static final int INLINE
Identifier for INLINE datastreams

See Also:
Constant Field Values

BASIS

public static final int BASIS
Identifier for BASIS datastreams

See Also:
Constant Field Values

m_dirty

protected boolean m_dirty
Whether this datastream is dirty

Constructor Detail

DataStream

public DataStream(java.io.File tempDir,
                  java.lang.String id)
Constructs a datastream with a given temporary directory to write itself to, and an identifier.

Method Detail

getType

public abstract int getType()
Returns INLINE or BASIS.


getId

public java.lang.String getId()
Gets the id of the datastream inside the object.


getMimeType

public java.lang.String getMimeType()
Gets the mime type.


setMimeType

public void setMimeType(java.lang.String mimeType)
Sets the mime type.


getSize

public long getSize()
Gets the size, in bytes.


getData

public java.io.InputStream getData()
                            throws java.io.IOException
Gets an InputStream to the local copy of the datastream.

Throws:
java.io.IOException

setData

public void setData(java.io.InputStream in)
             throws java.io.IOException
Reads the bytes from the given InputStream as the data for this digital object. When finished, the InputStream is closed.

Throws:
java.io.IOException

isDirty

public boolean isDirty()

setClean

public void setClean()

clearData

public void clearData()