R - a read handle or OperationNotSupported in the com.marklogic.client.io.marker packageW - a write handle or OperationNotSupported in the com.marklogic.client.io.marker packagepublic abstract class BaseHandle<R,W>
extends com.marklogic.client.impl.HandleImplementation<R,W>
BaseHandle is the base class for content representations such as byte arrays, strings, input streams, character readers, files, POJO (Plain Old Java Object) structures and so on. Content representations are used for query options, search results, values results, document metadata, and documents in binary, JSON, text, and XML formats. Read handles receive content from the server and must implement the receiveAs() and receiveContent() methods. Write handles send content to the server, must implement the sendContent() method, and should initialize the setResendable() accessor. A handle can support both read and write operations.
UNKNOWN_LENGTH| Constructor and Description |
|---|
BaseHandle()
Zero-argument constructor.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getByteLength()
Returns the length of the content in bytes as returned by the server.
|
Format |
getFormat()
Returns the format of the content.
|
String |
getMimetype()
Returns the mimetype of the content.
|
long |
getServerTimestamp()
Returns the server timestamp, whether set by setPointInTimeQueryTimestamp
or setResponseServerTimestamp.
|
void |
setByteLength(long length)
Specifies the length of the content in bytes or the UNKNOWN_LENGTH constant if the length of the content is not known.
|
void |
setFormat(Format format)
Specifies the format of the content as binary, JSON, text, or XML.
|
void |
setMimetype(String mimetype)
Specifies the mimetype of the content such as application/json, text/plain, or application/xml.
|
void |
setServerTimestamp(long serverTimestamp) |
public Format getFormat()
ContentDescriptorReturns the format of the content.
public void setFormat(Format format)
ContentDescriptorSpecifies the format of the content as binary, JSON, text, or XML.
format - the format of the contentpublic String getMimetype()
ContentDescriptorReturns the mimetype of the content.
public void setMimetype(String mimetype)
ContentDescriptorSpecifies the mimetype of the content such as application/json, text/plain, or application/xml.
mimetype - the content mimetypepublic long getServerTimestamp()
com.marklogic.client.impl.HandleImplementationpublic void setServerTimestamp(long serverTimestamp)
public long getByteLength()
ContentDescriptorReturns the length of the content in bytes as returned by the server. This value is usually not set when reading from a local source (such as a file or an input stream). The byte length won’t be returned by the server for very large documents for performance reasons. The byte length can be larger than the character length if the content contains multi-byte characters.
public void setByteLength(long length)
ContentDescriptorSpecifies the length of the content in bytes or the UNKNOWN_LENGTH constant if the length of the content is not known.
length - the content length in bytesCopyright © 2013-2017 MarkLogic Corporation.