|
XCC/J 3.1-9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.marklogic.xcc.ContentFactory
A helper class for creating instances of Content.
| Method Summary | |
static Content |
newContent(String uri,
byte[] documentBytes,
ContentCreateOptions createOptions)
Create a new Content object from a byte array. |
static Content |
newContent(String uri,
Document document,
ContentCreateOptions createOptions)
Create a new Content object from a W3C DOM Document object. |
static Content |
newContent(String uri,
File documentFile,
ContentCreateOptions createOptions)
Create a new Content object from a File object. |
static Content |
newContent(String uri,
InputStream documentStream,
ContentCreateOptions createOptions)
Create a new Content object by consuming the given InputStream
and buffereing it in memory. |
static Content |
newContent(String uri,
Node documentNode,
ContentCreateOptions createOptions)
Create a new Content object from a W3C DOM Node object. |
static Content |
newContent(String uri,
RandomAccessFile documentFile,
ContentCreateOptions createOptions)
Create a new Content object from a RandomAccessFile object. |
static Content |
newContent(String uri,
String documentString,
ContentCreateOptions createOptions)
Create a new Content object from a String. |
static Content |
newContent(String uri,
URI documentUri,
ContentCreateOptions createOptions)
Create a new Content object from a URI, buffering
so that it's rewindable and only accesses the URL one time. |
static Content |
newContent(String uri,
URL documentUrl,
ContentCreateOptions createOptions)
Create a new Content object from a URI, buffering
so that it's rewindable and only accesses the URL one time. |
static Content |
newContent(String uri,
XdmNode documentNode,
ContentCreateOptions createOptions)
Create a new Content object from an XdmNode. |
static Content |
newUnBufferedContent(String uri,
InputStream documentStream,
ContentCreateOptions createOptions)
Create a new non-rewindable Content object for the
given InputStream. |
static Content |
newUnBufferedContent(String uri,
URI documentUri,
ContentCreateOptions createOptions)
Create a new, non-rewindable Content object from a URI. |
static Content |
newUnBufferedContent(String uri,
URL documentUrl,
ContentCreateOptions createOptions)
Create a new, non-rewindable Content object from a URL. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static Content newContent(String uri,
Document document,
ContentCreateOptions createOptions)
Content object from a W3C DOM Document object.
If not explicitly overridden, the
document format will be set to XML.
This factory method makes use of the standard JAX
TransformerFactory facility to serialize the DOM
to a UTF-8-encoded byte stream.
See TransformerFactory.newInstance()
for information on how to customize the transformer implementation.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.document - A W3C DOM Document object which is the content.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
public static Content newContent(String uri,
Node documentNode,
ContentCreateOptions createOptions)
Content object from a W3C DOM Node object.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.
If not explicitly overridden, the
document format will be set to XML.
This factory method makes use of the standard JAX
TransformerFactory facility to serialize the DOM
to a UTF-8-encoded byte stream.
See TransformerFactory.newInstance()
for information on how to customize the transformer implementation.documentNode - A W3C DOM Node object which is the content.
Only Nodes of type Element or Text are valid.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
public static Content newContent(String uri,
XdmNode documentNode,
ContentCreateOptions createOptions)
Content object from an XdmNode. This
object may have been constructed locally or received as a member
of a ResultSequence.
If not explicitly overridden, the
document format will be set to XML.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentNode - An instance of XdmNode which is the
document content. Only nodes of type XdmElement,
XdmText or
XdmBinary are valid.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
public static Content newContent(String uri,
File documentFile,
ContentCreateOptions createOptions)
Create a new Content object from a File object.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentFile - A File object from which the content will be read.
If the createOptions argument selects
DocumentFormat.BINARY, the content of
the file will be transfered as an opaque blob. Otherwise, the
file is assumed to be UTF-8 encoded text.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
public static Content newContent(String uri,
RandomAccessFile documentFile,
ContentCreateOptions createOptions)
throws IOException
Content object from a RandomAccessFile object.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentFile - An open RandomAccessaFile object from which the content will be read.
File data will be read from the current position to end-of-file.
If the createOptions argument selects
DocumentFormat.BINARY, the content of
the file will be transfered as an opaque blob. Otherwise, the
file is assumed to be UTF-8 encoded text.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
IOException - If there is a problem reading data
from the file.
public static Content newUnBufferedContent(String uri,
URL documentUrl,
ContentCreateOptions createOptions)
throws IOException
Content object from a URL.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentUrl - A URL object that represents the location
from which the content can be fetched.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
IOException - If there is a problem creating a URL
or opening a data stream.
public static Content newUnBufferedContent(String uri,
URI documentUri,
ContentCreateOptions createOptions)
throws IOException
Content object from a URI.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentUri - A URI object that represents the location
from which the content can be fetched.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
IOException - If there is a problem creating a URL
or opening a data stream.
public static Content newContent(String uri,
URL documentUrl,
ContentCreateOptions createOptions)
throws IOException
Content object from a URI, buffering
so that it's rewindable and only accesses the URL one time.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentUrl - A URL object that represents the location
from which the content can be fetched.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
IOException - If there is a problem creating a URL
or reading the data from the stream.
public static Content newContent(String uri,
URI documentUri,
ContentCreateOptions createOptions)
throws IOException
Content object from a URI, buffering
so that it's rewindable and only accesses the URL one time.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentUri - A URI object that represents the location
from which the content can be fetched. Unlike URLs,
URI objects are not validated when they are created.
This method converts the URI to a URL. If
this parameter does not represent a valid URL, an exception
will be thrown.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
IOException - If there is a problem creating a URL
or reading the data from the stream.
IllegalArgumentException - If the URI is not absolute.
public static Content newContent(String uri,
String documentString,
ContentCreateOptions createOptions)
Content object from a String.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentString - A String which will be stored as the content
of the document. If the createOptions argument selects
DocumentFormat.BINARY, the bytes
representing the UTF-8 encoding of the String will be stored.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)DocumentFormat
public static Content newContent(String uri,
byte[] documentBytes,
ContentCreateOptions createOptions)
Content object from a byte array.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new content.documentBytes - A byte array which will be stored as the content
of the document. If the createOptions argument is null, then
DocumentFormat.BINARY will be assumed.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)DocumentFormat
public static Content newContent(String uri,
InputStream documentStream,
ContentCreateOptions createOptions)
throws IOException
Content object by consuming the given InputStream
and buffereing it in memory. This factory method immediately reads the
stream to the end and buffers it. This could result in an OutOfMemoryError
if the stream contains a large amount of data. The provided documentStream
will be closed.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new value.documentStream - The stream making up the document content.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
IOException - If there is a problem reading the documentStream.
public static Content newUnBufferedContent(String uri,
InputStream documentStream,
ContentCreateOptions createOptions)
Create a new non-rewindable Content object for the
given InputStream. Note that the Content instance
returned is not rewindable
(Content.isRewindable() == false)
which means that auto-retry cannot be performed is there is
a problem inserting the content.
uri - The URI (name) with which the document will be inserted
into the content store. If the URI already exists in the store,
it will be replaced with the new value.documentStream - The stream making up the document content.createOptions - Creation meta-information to be applied
when the content is inserted into the contentbase. These options
control the document format (xml, text, binary) and access
permissions.
Content object suitable for passing to
Session.insertContent(Content)
|
XCC/J 3.1-9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com