com.bigdata.bfs
Class DocumentImpl

java.lang.Object
  extended by com.bigdata.bfs.DocumentHeaderImpl
      extended by com.bigdata.bfs.DocumentImpl
All Implemented Interfaces:
Document, DocumentHeader

public class DocumentImpl
extends DocumentHeaderImpl
implements Document

Flyweight document implementation.

Version:
$Id: DocumentImpl.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
 
Fields inherited from class com.bigdata.bfs.DocumentHeaderImpl
log
 
Constructor Summary
DocumentImpl()
          Create a new empty document.
DocumentImpl(DocumentHeader header)
          Copy constructor for header information.
DocumentImpl(Map<String,Object> metadata)
          Copy constructor for header information.
 
Method Summary
 void copyReader(String encoding, Reader r)
          Set the content by copying characters from the given reader and converting them into bytes using the specified encoding.
 void copyStream(byte[] b)
          Set the content by copying the byte[].
 void copyStream(byte[] b, int off, int len)
          Set the content by copying the byte[].
 void copyStream(InputStream is)
          Set the content by copying the given stream.
 void copyString(String encoding, String s)
          Set the content by converting characters to into bytes using the specified encoding.
 InputStream getInputStream()
          An input stream on the byte[] stored in the IContentRepository.
 Reader getReader()
          A reader on the byte[] stored in the IContentRepository where bytes are decoded to characters using the encoding identified by DocumentHeader.getContentEncoding().
 
Methods inherited from class com.bigdata.bfs.DocumentHeaderImpl
asMap, exists, getContentEncoding, getContentType, getEarliestVersionCreateTime, getId, getMetadataUpdateTime, getProperty, getVersion, getVersionCreateTime, setContentEncoding, setContentType, setId, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bigdata.bfs.DocumentHeader
asMap, exists, getContentEncoding, getContentType, getEarliestVersionCreateTime, getId, getMetadataUpdateTime, getProperty, getVersion, getVersionCreateTime
 

Constructor Detail

DocumentImpl

public DocumentImpl()
Create a new empty document.


DocumentImpl

public DocumentImpl(Map<String,Object> metadata)
Copy constructor for header information.

Parameters:
metadata - to copy

DocumentImpl

public DocumentImpl(DocumentHeader header)
Copy constructor for header information.

Parameters:
header - to copy
Method Detail

getInputStream

public InputStream getInputStream()
Description copied from interface: Document
An input stream on the byte[] stored in the IContentRepository.

Specified by:
getInputStream in interface Document

getReader

public Reader getReader()
                 throws UnsupportedEncodingException
Description copied from interface: Document
A reader on the byte[] stored in the IContentRepository where bytes are decoded to characters using the encoding identified by DocumentHeader.getContentEncoding().

Specified by:
getReader in interface Document
Throws:
UnsupportedEncodingException

copyStream

public void copyStream(byte[] b,
                       int off,
                       int len)
Set the content by copying the byte[].

Note: Do NOT use this when the content is character data since the encoding attribute will NOT be set.

Parameters:
b - The content.
off - The offset of the 1st byte to be copied.
len - The #of bytes to be copied.

copyStream

public void copyStream(byte[] b)
Set the content by copying the byte[].

Note: Do NOT use this when the content is character data since the encoding attribute will NOT be set.

Parameters:
b - The content.

copyStream

public void copyStream(InputStream is)
                throws IOException
Set the content by copying the given stream.

Note: Do NOT use this when the content is character data since the encoding attribute will NOT be set.

Parameters:
is -
Throws:
IOException

copyString

public void copyString(String encoding,
                       String s)
                throws UnsupportedEncodingException
Set the content by converting characters to into bytes using the specified encoding.

Parameters:
encoding - The encoding that will be used to convert characters to bytes.
s - The string.
Throws:
UnsupportedEncodingException

copyReader

public void copyReader(String encoding,
                       Reader r)
                throws IOException
Set the content by copying characters from the given reader and converting them into bytes using the specified encoding.

Parameters:
encoding - The encoding that will be used to convert characters to bytes.
r - The reader.
Throws:
IOException


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.