T
- The type of the handle used for each split
payloadSplitter<T>
public class JSONSplitter<T extends JSONWriteHandle> extends java.lang.Object implements Splitter<T>
Modifier and Type | Class | Description |
---|---|---|
static class |
JSONSplitter.ArrayVisitor |
The basic visitor only splits objects or arrays
under top array.
|
static interface |
JSONSplitter.UriMaker |
UriMaker which generates URI for each split
file
|
static class |
JSONSplitter.Visitor<T extends AbstractWriteHandle> |
The Visitor class is used to accumulate and
inspect state during the depth-first traversal of the JSON tree and
make the decision of how to split the JSON file.
|
Constructor | Description |
---|---|
JSONSplitter(JSONSplitter.Visitor<T> visitor) |
Construct a JSONSplitter which splits the JSON
file according to the visitor.
|
Modifier and Type | Method | Description |
---|---|---|
long |
getCount() |
|
JSONSplitter.UriMaker |
getUriMaker() |
Get the UriMaker of the splitter
|
JSONSplitter.Visitor<T> |
getVisitor() |
Get the visitor used in JSONSplitter
class.
|
static JSONSplitter<StringHandle> |
makeArraySplitter() |
Construct a simple JSONSplitter which split
objects or arrays under an array.
|
void |
setUriMaker(JSONSplitter.UriMaker uriMaker) |
Set the UriMaker to the splitter
|
void |
setVisitor(JSONSplitter.Visitor<T> visitor) |
Set the visitor to select objects or arrays to
split in JSONSplitter.
|
java.util.stream.Stream<T> |
split(com.fasterxml.jackson.core.JsonParser input) |
Take an input of JsonParser created from the
JSON file and split it into a stream of handles to write to
database.
|
java.util.stream.Stream<T> |
split(java.io.InputStream input) |
Takes an InputStream of a JSON file and split it
into a steam of handles.
|
java.util.stream.Stream<DocumentWriteOperation> |
splitWriteOperations(com.fasterxml.jackson.core.JsonParser input,
java.lang.String splitFilename) |
Take an input of JsonParser created from the
JSON file and split it into a stream of DocumentWriteOperations to
write to database.
|
java.util.stream.Stream<DocumentWriteOperation> |
splitWriteOperations(java.io.InputStream input) |
Takes an InputStream of a JSON file and split it
into a steam of DocumentWriteOperation to write to database.
|
java.util.stream.Stream<DocumentWriteOperation> |
splitWriteOperations(java.io.InputStream input,
java.lang.String inputName) |
Takes an InputStream of a JSON file and file
name and split it into a steam of DocumentWriteOperation to write
to database.
|
public JSONSplitter(JSONSplitter.Visitor<T> visitor)
visitor
- describes how to spit the filepublic static JSONSplitter<StringHandle> makeArraySplitter()
public JSONSplitter.Visitor<T> getVisitor()
public void setVisitor(JSONSplitter.Visitor<T> visitor)
visitor
- the visitor describes the rule to split
the JSON filepublic long getCount()
getCount
in interface Splitter<T extends JSONWriteHandle>
public java.util.stream.Stream<T> split(java.io.InputStream input) throws java.io.IOException
split
in interface Splitter<T extends JSONWriteHandle>
input
- is the incoming InputStream of a JSON
file.java.io.IOException
public java.util.stream.Stream<DocumentWriteOperation> splitWriteOperations(java.io.InputStream input) throws java.lang.Exception
splitWriteOperations
in
interface Splitter<T extends JSONWriteHandle>
input
- is the incoming input stream of a JSON
filejava.lang.Exception
public java.util.stream.Stream<DocumentWriteOperation> splitWriteOperations(java.io.InputStream input, java.lang.String inputName) throws java.lang.Exception
splitWriteOperations
in
interface Splitter<T extends JSONWriteHandle>
input
- is the incoming input stream of a JSON
fileinputName
- is the name of input file, including
name and extension. It is used to generate URLs for split files.The
inputName could either be provided here or in user-defined
UriMaker.java.lang.Exception
public java.util.stream.Stream<T> split(com.fasterxml.jackson.core.JsonParser input) throws java.io.IOException
input
- JsonParser created from the JSON filejava.io.IOException
public java.util.stream.Stream<DocumentWriteOperation> splitWriteOperations(com.fasterxml.jackson.core.JsonParser input, java.lang.String splitFilename)
input
- JsonParser created from the JSON filesplitFilename
- is the name of input file,
including name and extension. It is used to generate URLs for split
files.The inputName could either be provided here or in
user-defined UriMaker.public JSONSplitter.UriMaker getUriMaker()
public void setUriMaker(JSONSplitter.UriMaker uriMaker)
uriMaker
- the uriMaker to generate URI of each
split file.Copyright © 2013-2019 MarkLogic Corporation.