Overview | Package | Class | Tree | Deprecated | Index | Help
| XCC/J 4.2-9
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.marklogic.xcc.examples
Class ContentFetcher

    java.lang.Object
      com.marklogic.xcc.examples.ContentFetcher

    public class ContentFetcher

extends Object

This class fetches documents from the conentbase and writes their serialized contents to a provided `OutputStream`.

Click here for the source code for this class

Constructor Summary
`ContentFetcher(URI serverUri)` Construct an instance that may be used to fetch documents.

Method Summary
`static void` | `main(String[] args)` Command-line main() method to fetch a document.
`void` | `setRequestOptions(RequestOptions options)` Set (or clear) the `RequestOptions` instance to associate with submitted queries.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ContentFetcher

    public ContentFetcher(URI serverUri)
                   throws XccConfigException

  Construct an instance that may be used to fetch documents.

  Parameters:
    `serverUri` - A URI identifying a `ContentSource`, in the format expected by `ContentSourceFactory.newContentSource(java.net.URI)`.
  Throws:
    `XccConfigException` - Thrown if a `Session` cannot be created. This usually indicates that the host/port or user credentials are incorrect.

Method Detail

### setRequestOptions

    public void setRequestOptions(RequestOptions options)

  Set (or clear) the `RequestOptions` instance to associate with submitted queries.

  Note: It's a good idea to set CachedResult=false. Since the data is being written straight out to an `OutputStream` there is no need to buffer the document first. Streaming will also accommodate arbitrarily large documents without running out of memory. Setting an options value of null will use defaults, which includes cached result mode.

  Parameters:
    `options` - An instance of `RequestOptions` or null.

### main

    public static void main(String[] args)
                     throws Exception

  Command-line main() method to fetch a document.

  Parameters:
    `args` - Arg 1: A server URL as per `ContentSourceFactory.newContentSource(java.net.URI)`. Arg 2: A document URI. Optional Args 3&4: "-o outputfilename"
  Throws:
    `Exception` - No exceptions are handled, anything that goes wrong will spew out a stack trace and exit.

Overview | Package | Class | Tree | Deprecated | Index | Help
| XCC/J 4.2-9
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 MarkLogic Corporation, All Rights Reserved.

Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com