public class NDocEncoder
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
NDocEncoder.CharSeparatorType
Separator types when inlined in text.
|
static class |
NDocEncoder.CommonMetaNames
Common meta names, to be used with newContext().
|
static class |
NDocEncoder.LanguageId
Language identifier.
|
static class |
NDocEncoder.SeparatorType
Separator types.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
currentContext |
static java.lang.String |
MIME_APPLICATION_X_EXALEAD_NDOC
MIME type of a NDoc binary document.
|
protected static int |
NDOC_ANNOTATION_END |
protected static int |
NDOC_ANNOTATION_START |
protected static int |
NDOC_CHUNK |
protected static int |
NDOC_CONTEXT |
protected static byte |
NDOC_MAJOR_VERSION |
protected static int |
NDOC_MAX |
protected static byte |
NDOC_MINOR_VERSION |
protected static int |
NDOC_MOT_BINARY |
protected static int |
NDOC_SCORE |
protected static int |
NDOC_SEPARATOR |
protected static int |
NDOC_SIGNATURE |
protected java.io.ByteArrayOutputStream |
output |
static byte[] |
SIGNATURE |
Constructor and Description |
---|
NDocEncoder()
Create a new NDoc encoder.
|
Modifier and Type | Method and Description |
---|---|
void |
addBinary(byte[] binary)
Add a binary chunk in the current context.
|
void |
addMeta(Meta meta)
Add a meta-data (a text within a specific context)
|
void |
addMeta(java.lang.String name,
java.lang.String value)
Add a meta-data (a text within a specific context)
|
void |
addMetas(MetaContainer metas)
Add a set of meta-data.
|
void |
addSeparator(NDocEncoder.SeparatorType sep)
Add a separator.
|
protected void |
addSignature() |
void |
addString(java.lang.String string)
Add a text chunk in the current context.
|
void |
addText(java.lang.String text)
Add text as "text" context chunk.
|
void |
endAnnotate(java.lang.String name)
End an annotation.
|
void |
ensureContext(java.lang.String name)
Ensure the given context is entered.
|
byte[] |
getBytes()
Serialize the current NDoc document into an array of bytes.
|
static Document |
getDocumentWithNDocMetas(Document doc)
Takes a Document, compact meta-data into a binary part, and return a new
Document version.
|
Part |
getNDocPart()
Get a binary NDoc meta-data part
|
static Part |
getNDocPartFromMetas(MetaContainer metas)
Get a binary NDoc meta-data part, from an existing MetaContainer
|
static void |
main(java.lang.String[] args)
Main sample.
|
protected int |
memRefWrite8(long src) |
void |
newContext(java.lang.String name)
Enter in a new context.
|
void |
newContextEx(java.lang.String name,
NDocEncoder.LanguageId id)
Enter in a new context.
|
protected void |
push(byte c) |
protected void |
push(long c) |
protected void |
pushData(byte[] data) |
protected void |
pushData(java.lang.String text) |
protected void |
pushRawData(byte[] data) |
protected void |
pushSize(long size) |
protected void |
pushType(int type) |
void |
reset()
Reset the current NDoc document, discarding all previous operations.
|
void |
startAnnotate(java.lang.String name,
java.lang.String value)
Start an annotation.
|
public static final java.lang.String MIME_APPLICATION_X_EXALEAD_NDOC
protected static final int NDOC_CHUNK
protected static final int NDOC_CONTEXT
protected static final int NDOC_ANNOTATION_START
protected static final int NDOC_ANNOTATION_END
protected static final int NDOC_SEPARATOR
protected static final int NDOC_SCORE
protected static final int NDOC_MOT_BINARY
protected static final int NDOC_MAX
protected static final int NDOC_SIGNATURE
protected static final byte NDOC_MAJOR_VERSION
protected static final byte NDOC_MINOR_VERSION
public static final byte[] SIGNATURE
protected final java.io.ByteArrayOutputStream output
protected java.lang.String currentContext
protected void push(byte c)
protected void push(long c)
protected void pushRawData(byte[] data)
protected void pushSize(long size)
protected void pushData(byte[] data)
protected void pushData(java.lang.String text)
protected int memRefWrite8(long src)
protected void pushType(int type)
protected void addSignature()
public void addString(java.lang.String string)
string
- The string chunk.public void addBinary(byte[] binary)
binary
- The binary chunk.public void addText(java.lang.String text)
text
- The text to be added.public void newContextEx(java.lang.String name, NDocEncoder.LanguageId id)
name
- The context name (such as "text") ; see @c CommonMetaNamesid
- The language identifierpublic void newContext(java.lang.String name)
name
- The context name (such as "text") ; see @c CommonMetaNamespublic void ensureContext(java.lang.String name)
name
- The context name (such as "text") ; see @c CommonMetaNamespublic void addMeta(java.lang.String name, java.lang.String value)
name
- The meta namevalue
- The associated meta textpublic void addMeta(Meta meta)
meta
- The meta to be added.public void addMetas(MetaContainer metas)
metas
- The meta set to be added.public void addSeparator(NDocEncoder.SeparatorType sep)
sep
- The separator to be added.public void startAnnotate(java.lang.String name, java.lang.String value)
name
- The annotation name to be started.value
- The annotation optional value.public void endAnnotate(java.lang.String name)
name
- The annotation name to be ended.public void reset()
public byte[] getBytes()
public Part getNDocPart()
public static Part getNDocPartFromMetas(MetaContainer metas)
metas
- The meta-data setpublic static Document getDocumentWithNDocMetas(Document doc) throws PushAPIException
doc
- The original document.PushAPIException
- Upon error.public static void main(java.lang.String[] args) throws java.io.IOException
args
- Arguments.java.io.IOException
- Upon I/O error.Copyright © 2021 Dassault Systèmes, All Rights Reserved.