org.outerj.daisy.repository
Interface Part


public interface Part

Parts belong to documents (or versions of documents), and are the things that contain the actual data of the document.

A part is always associated with a PartType.

The repository itself does not really place any restrictions on the kind of data that can be contained in a part. However, parts whose part type's PartType.isDaisyHtml() method returns true should contain XML-well-formed HTML (not namespaced XHTML).

Note that a part has no setters methods, modifications can only be done through the containing Document. This is because parts can also be obtained from Versions, which are not modifiable.


Method Summary
 byte[] getData()
          Get the actual data stored in this part.
 java.io.InputStream getDataStream()
          Get the data stored in this part.
 java.lang.String getFileName()
          Get the file name for this part, can be null.
 java.lang.String getMimeType()
          Get the mime-type of the data currently stored in this part.
 long getSize()
          Get the size of the data.
 long getTypeId()
          The id of the part type of this part.
 java.lang.String getTypeName()
          Get the name of the part type.
 org.outerx.daisy.x10.PartDocument getXml()
          Get an XML document describing this part.
 

Method Detail

getTypeId

public long getTypeId()
The id of the part type of this part. More information on the part type can then be retrieved from the RepositorySchema.


getTypeName

public java.lang.String getTypeName()
Get the name of the part type.


getMimeType

public java.lang.String getMimeType()
Get the mime-type of the data currently stored in this part.


getFileName

public java.lang.String getFileName()
Get the file name for this part, can be null. The file name is a user-selected string used to store a proposed file name that can be used when downloading the data stored in this part into a file. It is not the name of the file that the repository uses to store the data (if this would be file-based, which isn't defined by this API).


getData

public byte[] getData()
               throws RepositoryException
Get the actual data stored in this part. The data is only retrieved when this method is called, and is not stored inside this object after retrieval.

Throws:
RepositoryException

getDataStream

public java.io.InputStream getDataStream()
                                  throws RepositoryException
Get the data stored in this part. The caller is, of course, responsible for closing the input stream in order to avoid resource leakage (thus always do this in a try-finally block).

Throws:
RepositoryException

getSize

public long getSize()
Get the size of the data. For new or modified parts, this will return -1 until the document to which the part belongs is saved.


getXml

public org.outerx.daisy.x10.PartDocument getXml()
Get an XML document describing this part.



Copyright © -2005 . All Rights Reserved.