|
XCC/J 3.2-9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.marklogic.xcc.examples.OutputStreamContent
This is a specialized implementation of the Content
interface which allows you to write your content to an
OutputStream.
Click here for the source code for this class
This class creates a piped pair
of streams. The source (InputStream) is passed
to the standard factory method
ContentFactory.newUnBufferedContent(String, java.io.InputStream, com.marklogic.xcc.ContentCreateOptions).
The sink (OutputStream) can be retrieved with
the getOutputStream() method.
NOTE: You must write to the
OutputStream in a different thread than the
one in which you invoke Session.insertContent(com.marklogic.xcc.Content)
or your program may deadlock.
The OutputStreamInserter class shows an example of
how to use this class.
OutputStreamInserter| Constructor Summary | |
OutputStreamContent(String uri,
ContentCreateOptions options)
Construct an instance with the usual URI and options parameters, the actual content will be read from the other end of the pipe provided by getOutputStream(). |
|
| Method Summary | |
void |
close()
This method will be called after successfully consuming the content from the InputStream returned by openDataStream(). |
ContentCreateOptions |
getCreateOptions()
Return the ContentCreateOptions object which
should be applied to this object. |
OutputStream |
getOutputStream()
Return the end of the pipe to which you will write your content (the sink). |
String |
getUri()
The URI with which this content should be inserted. |
boolean |
isRewindable()
The answer is "no". |
InputStream |
openDataStream()
Passes the read end (source) of the pipe to the content insertion framework. |
void |
rewind()
This streaming-only implementation is not rewindable. |
long |
size()
Unknown size. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public OutputStreamContent(String uri,
ContentCreateOptions options)
throws IOException
getOutputStream().
uri - The URI by which the content (document) will be known in the contentbase.options - An instance of ContentCreateOptions.
IOException - If there is a problem creating the pipe (unlikely).| Method Detail |
public OutputStream getOutputStream()
OutputStream. Be sure to
close this object when you've written all the data.public String getUri()
Content
getUri in interface Content
public InputStream openDataStream()
throws IOException
openDataStream in interface ContentInputStream.
IOException - Will never happen in this implementation.public ContentCreateOptions getCreateOptions()
ContentContentCreateOptions object which
should be applied to this object. Note that if none
was provided to the factory method that created this
Content instance, one may have been created
with appropriate defaults for the content provided.
getCreateOptions in interface ContentContentCreateOptions.public boolean isRewindable()
isRewindable in interface Content
public void rewind()
throws IOException
rewind in interface ContentIOException - Will always be thrown if called.public long size()
size in interface Contentpublic void close()
ContentContent.openDataStream(). This method need not
close the stream, that is the responsibility of
the client, but it may invalidate the stream.
This method is to inform the implementation that
any resources it may be holding can be released.
close in interface Content
|
XCC/J 3.2-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