Package com.marklogic.mapreduce
Class DatabaseDocument
- java.lang.Object
-
- com.marklogic.mapreduce.DatabaseDocument
-
- All Implemented Interfaces:
InternalConstants,MarkLogicDocument,org.apache.hadoop.io.Writable
- Direct Known Subclasses:
DatabaseDocumentWithMeta
public class DatabaseDocument extends Object implements MarkLogicDocument, InternalConstants
AMarkLogicDocumentretrieved from a database via MarkLogic Server.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]contentprotected ContentTypecontentTypeprotected InputStreamisstatic org.apache.commons.logging.LogLOG-
Fields inherited from interface com.marklogic.mapreduce.InternalConstants
MAX_BUFFER_SIZE
-
-
Constructor Summary
Constructors Constructor Description DatabaseDocument()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getContentAsByteArray()Return content as byte array.InputStreamgetContentAsByteStream()Return content as byte stream.MarkLogicNodegetContentAsMarkLogicNode()Return content as MarkLogicNode.StringgetContentAsString()Return content as String.org.apache.hadoop.io.TextgetContentAsText()Return content as Text.longgetContentSize()Return byte length of the content.ContentTypegetContentType()Return content type of the document.booleanisStreamable()Whether the content can be streamed.voidreadFields(DataInput in)voidset(com.marklogic.xcc.ResultItem item)voidsetContent(byte[] content)voidsetContentType(ContentType type)voidwrite(DataOutput out)
-
-
-
Field Detail
-
LOG
public static final org.apache.commons.logging.Log LOG
-
content
protected byte[] content
-
is
protected InputStream is
-
contentType
protected ContentType contentType
-
-
Method Detail
-
getContentType
public ContentType getContentType()
Description copied from interface:MarkLogicDocumentReturn content type of the document.- Specified by:
getContentTypein interfaceMarkLogicDocument- Returns:
- content type of the document.
-
getContentAsText
public org.apache.hadoop.io.Text getContentAsText()
Description copied from interface:MarkLogicDocumentReturn content as Text.- Specified by:
getContentAsTextin interfaceMarkLogicDocument- Returns:
- content.
-
getContentAsByteArray
public byte[] getContentAsByteArray()
Description copied from interface:MarkLogicDocumentReturn content as byte array.- Specified by:
getContentAsByteArrayin interfaceMarkLogicDocument- Returns:
- content.
-
getContentAsByteStream
public InputStream getContentAsByteStream()
Description copied from interface:MarkLogicDocumentReturn content as byte stream.- Specified by:
getContentAsByteStreamin interfaceMarkLogicDocument- Returns:
- content.
-
getContentAsMarkLogicNode
public MarkLogicNode getContentAsMarkLogicNode()
Description copied from interface:MarkLogicDocumentReturn content as MarkLogicNode.- Specified by:
getContentAsMarkLogicNodein interfaceMarkLogicDocument- Returns:
- content.
-
getContentAsString
public String getContentAsString() throws UnsupportedEncodingException
Description copied from interface:MarkLogicDocumentReturn content as String.- Specified by:
getContentAsStringin interfaceMarkLogicDocument- Returns:
- content.
- Throws:
UnsupportedEncodingException
-
set
public void set(com.marklogic.xcc.ResultItem item)
-
setContent
public void setContent(byte[] content)
-
setContentType
public void setContentType(ContentType type)
-
readFields
public void readFields(DataInput in) throws IOException
- Specified by:
readFieldsin interfaceMarkLogicDocument- Specified by:
readFieldsin interfaceorg.apache.hadoop.io.Writable- Throws:
IOException
-
write
public void write(DataOutput out) throws IOException
- Specified by:
writein interfaceMarkLogicDocument- Specified by:
writein interfaceorg.apache.hadoop.io.Writable- Throws:
IOException
-
getContentSize
public long getContentSize()
Description copied from interface:MarkLogicDocumentReturn byte length of the content.- Specified by:
getContentSizein interfaceMarkLogicDocument- Returns:
- byte length of the content.
-
isStreamable
public boolean isStreamable()
Description copied from interface:MarkLogicDocumentWhether the content can be streamed.- Specified by:
isStreamablein interfaceMarkLogicDocument- Returns:
- true for LargeBinaryDocument, false for the rest.
-
-