degu.degudocumentbuilder.ejb
Class RawDocument

java.lang.Object
  extended by degu.degudocumentbuilder.ejb.RawDocument
All Implemented Interfaces:
java.io.Serializable

public class RawDocument
extends java.lang.Object
implements java.io.Serializable

A data object which is supposed to be wired.

See Also:
Serialized Form

Field Summary
private  Compress compress
           
private  byte[] data
           
private  java.io.File file
           
private  MimeTypeT mimeType
           
private  java.lang.String origFileName
           
private  DocumentSource source
           
 
Constructor Summary
RawDocument(java.io.File file, DocumentSource source)
          ctor The document is represented as a file reference.
RawDocument(java.lang.String origFileName, DocumentSource source, byte[] data, Compress compress)
          ctor Stores the document represented as data.
 
Method Summary
 byte[] getData()
          Get data returns the file as byte array.
 java.io.InputStream getInputStream()
          Gets a InputStream to access the document data.
 MimeTypeT getMimeType()
           
 java.lang.String getOrigFileName()
           
 DocumentSource getSource()
           
 boolean isGZipCompressed()
           
 void setMimeType(MimeTypeT mimeType)
          the client may set a mime type, however it will be ignored :-), the server will detect the type and reset it, respectively
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

origFileName

private java.lang.String origFileName

source

private DocumentSource source

data

private byte[] data

file

private java.io.File file

compress

private Compress compress

mimeType

private MimeTypeT mimeType
Constructor Detail

RawDocument

public RawDocument(java.lang.String origFileName,
                   DocumentSource source,
                   byte[] data,
                   Compress compress)
ctor Stores the document represented as data. Use this ctor when the object must be wired.

Parameters:
origFileName - the local file name
source - the source of the data, where did it come from?
data - the document as an byte array
compress - compress data or not

RawDocument

public RawDocument(java.io.File file,
                   DocumentSource source)
ctor The document is represented as a file reference. Use this ctor for a much better performance if degu client and degu server run in the same "address space", i.e. client and server see the same file system. WARNING: this won't work if the file is not located in the degu server "address space". The server won't find the file.

Parameters:
file -
source -
Method Detail

getOrigFileName

public java.lang.String getOrigFileName()

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Gets a InputStream to access the document data.

Returns:
Throws:
java.io.IOException

getSource

public DocumentSource getSource()

isGZipCompressed

public boolean isGZipCompressed()

getData

public byte[] getData()
               throws java.io.IOException
Get data returns the file as byte array. It may be that the returned byte array is compressed (check this with isGZipCompressed())!

Returns:
Throws:
java.io.IOException

setMimeType

public void setMimeType(MimeTypeT mimeType)
the client may set a mime type, however it will be ignored :-), the server will detect the type and reset it, respectively

Parameters:
mimeType -

getMimeType

public MimeTypeT getMimeType()