FastInfosetSerializer
DOMDocumentSerializer
, SAXDocumentSerializer
, StAXDocumentSerializer
public abstract class Encoder extends org.xml.sax.helpers.DefaultHandler implements FastInfosetSerializer
This class extends org.sax.xml.DefaultHandler so that concrete SAX implementations can be used with javax.xml.parsers.SAXParser and the parse methods that take org.sax.xml.DefaultHandler as a parameter.
Buffering of octets that are written to an OutputStream
is
supported in a similar manner to a BufferedOutputStream
.
Combining buffering with encoding enables better performance.
More than one fast infoset document may be encoded to the
OutputStream
.
Modifier and Type | Field | Description |
---|---|---|
protected int |
_b |
The current octet that is to be written.
|
protected static java.lang.String |
_characterEncodingSchemeSystemDefault |
Default character encoding scheme system property for the encoding
of content and attribute values.
|
protected char[] |
_charBuffer |
The internal buffer of characters used for the UTF-8 or UTF-16 encoding
of characters.
|
protected int |
_markIndex |
The current mark in the internal buffer.
|
protected byte[] |
_octetBuffer |
The internal buffer of bytes.
|
protected int |
_octetBufferIndex |
The current position in the internal buffer.
|
protected java.io.OutputStream |
_s |
The
OutputStream that the encoded XML infoset (the
fast infoset document) is written to. |
protected boolean |
_terminate |
True if terminatation of an information item is required
|
protected SerializerVocabulary |
_v |
The vocabulary that is used by the encoder
|
protected VocabularyApplicationData |
_vData |
The vocabulary application data that is used by the encoder
|
protected int |
attributeValueMapTotalCharactersConstraint |
The limit on the size of indexed Map for attribute values
Limit is measured in characters number
|
static java.lang.String |
CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY |
Character encoding scheme system property for the encoding
of content and attribute values.
|
protected int |
characterContentChunkMapTotalCharactersConstraint |
The limit on the size of indexed Map for character content chunks
Limit is measured in characters number
|
protected int |
maxAttributeValueSize |
The maximum size of [normalized value] of Attribute Information
Items that will be indexed.
|
protected int |
maxCharacterContentChunkSize |
The maximum size of character content chunks
of Character Information Items or Comment Information Items that
will be indexed.
|
protected int |
minAttributeValueSize |
The minimum size of [normalized value] of Attribute Information
Items that will be indexed.
|
protected int |
minCharacterContentChunkSize |
The minimum size of character content chunks
of Character Information Items or Comment Information Items that
will be indexed.
|
ATTRIBUTE_VALUE_MAP_MEMORY_CONSTRAINT, BUFFER_SIZE_PROPERTY, CHARACTER_CONTENT_CHUNK_MAP_MEMORY_CONSTRAINT, EXTERNAL_VOCABULARIES_PROPERTY, IGNORE_COMMENTS_FEATURE, IGNORE_DTD_FEATURE, IGNORE_PROCESSING_INSTRUCTIONS_FEATURE, IGNORE_WHITE_SPACE_TEXT_CONTENT_FEATURE, MAX_ATTRIBUTE_VALUE_SIZE, MAX_CHARACTER_CONTENT_CHUNK_SIZE, MIN_ATTRIBUTE_VALUE_SIZE, MIN_CHARACTER_CONTENT_CHUNK_SIZE, REGISTERED_ENCODING_ALGORITHMS_PROPERTY, UTF_16BE, UTF_8
Modifier | Constructor | Description |
---|---|---|
protected |
Encoder() |
Default constructor for the Encoder.
|
protected |
Encoder(boolean useLocalNameAsKeyForQualifiedNameLookup) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
canAddAttributeToTable(int length) |
Checks whether attribute table has enough memory to
store attribute value with the given length
|
boolean |
canAddCharacterContentToTable(int length,
CharArrayIntMap map) |
Checks whether character content table has enough memory to
store character content chunk with the given length
|
protected void |
encodeAIIBuiltInAlgorithmData(int id,
java.lang.Object data,
int offset,
int length) |
Encode the [normalized value] of an Attribute Information Item using
using a built in encoding algorithm.
|
protected void |
encodeAIIObjectAlgorithmData(int id,
java.lang.Object data,
EncodingAlgorithm ea) |
Encode the [normalized value] of an Attribute Information Item using
using an encoding algorithm.
|
protected void |
encodeAIIOctetAlgorithmData(int id,
byte[] d,
int offset,
int length) |
Encode the [normalized value] of an Attribute Information Item using
using an encoding algorithm.
|
protected void |
encodeAlphabetCharacters(java.lang.String alphabet,
char[] ch,
int offset,
int length,
boolean addToTable) |
Encode a chunk of Character Information Items using a restricted
alphabet table.
|
protected void |
encodeAttributeQualifiedNameOnSecondBit(java.lang.String namespaceURI,
java.lang.String prefix,
java.lang.String localName) |
Encode a qualified name of an Attribute Informaiton Item on the third bit
of an octet.
|
protected void |
encodeCharacters(char[] ch,
int offset,
int length) |
Encode a chunk of Character Information Items.
|
protected void |
encodeCharactersNoClone(char[] ch,
int offset,
int length) |
Encode a chunk of Character Information Items.
|
protected void |
encodeCIIBuiltInAlgorithmData(int id,
java.lang.Object data,
int offset,
int length) |
Encode a chunk of Character Information Items using
using an encoding algorithm.
|
protected void |
encodeCIIBuiltInAlgorithmDataAsCDATA(char[] ch,
int offset,
int length) |
Encode a chunk of Character Information Items using
using the CDATA built in encoding algorithm.
|
protected void |
encodeCIIObjectAlgorithmData(int id,
java.lang.Object data,
EncodingAlgorithm ea) |
Encode a chunk of Character Information Items using
using an encoding algorithm.
|
protected void |
encodeCIIOctetAlgorithmData(int id,
byte[] d,
int offset,
int length) |
Encode a chunk of Character Information Items using
using an encoding algorithm.
|
protected void |
encodeComment(char[] ch,
int offset,
int length) |
Encode a Comment Information Item.
|
protected void |
encodeCommentNoClone(char[] ch,
int offset,
int length) |
Encode a Comment Information Item.
|
protected void |
encodeDateTimeFourBitCharacters(char[] ch,
int offset,
int length,
boolean addToTable) |
Encode a chunk of Character Information Items using a date-time
alphabet that results in the encoding of a character in 4 bits
(or two characters per octet).
|
protected void |
encodeDateTimeNonIdentifyingStringOnFirstBit(java.lang.String s,
boolean addToTable,
boolean mustBeAddedToTable) |
|
protected void |
encodeDocumentTermination() |
Encode the termination of the Document Information Item.
|
protected void |
encodeDocumentTypeDeclaration(java.lang.String systemId,
java.lang.String publicId) |
Encode a Document Type Declaration.
|
protected void |
encodeElementQualifiedNameOnThirdBit(java.lang.String namespaceURI,
java.lang.String prefix,
java.lang.String localName) |
Encode a qualified name of an Element Informaiton Item on the third bit
of an octet.
|
protected void |
encodeElementTermination() |
Encode the termination of an Element Information Item.
|
protected void |
encodeFourBitCharacters(int id,
int[] table,
char[] ch,
int offset,
int length,
boolean addToTable) |
Encode a chunk of Character Information Items using a restricted
alphabet that results in the encoding of a character in 4 bits
(or two characters per octet).
|
protected void |
encodeHeader(boolean encodeXmlDecl) |
Encode the header of a fast infoset document.
|
protected void |
encodeIdentifyingNonEmptyStringOnFirstBit(java.lang.String s,
StringIntMap map) |
Encode a non empty identifying string on the first bit of an octet.
|
protected void |
encodeInitialVocabulary() |
Encode the initial vocabulary of a fast infoset document.
|
protected boolean |
encodeLiteralAttributeQualifiedNameOnSecondBit(java.lang.String namespaceURI,
java.lang.String prefix,
java.lang.String localName,
LocalNameQualifiedNamesMap.Entry entry) |
Encode a literal qualified name of an Attribute Informaiton Item on the
third bit of an octet.
|
protected void |
encodeLiteralElementQualifiedNameOnThirdBit(java.lang.String namespaceURI,
java.lang.String prefix,
java.lang.String localName,
LocalNameQualifiedNamesMap.Entry entry) |
Encode a literal qualified name of an Element Informaiton Item on the
third bit of an octet.
|
protected void |
encodeNamespaceAttribute(java.lang.String prefix,
java.lang.String uri) |
Encode a Attribute Information Item that is a namespace declaration.
|
protected void |
encodeNonEmptyCharacterStringOnFifthBit(char[] ch,
int offset,
int length) |
Encode a non empty string on the fifth bit of an octet using the UTF-8
or UTF-16 encoding.
|
protected void |
encodeNonEmptyCharacterStringOnFifthBit(java.lang.String s) |
Encode a non empty string on the fifth bit of an octet using the UTF-8
or UTF-16 encoding.
|
protected void |
encodeNonEmptyCharacterStringOnSeventhBit(char[] ch,
int offset,
int length) |
Encode a non empty string on the seventh bit of an octet using the UTF-8
or UTF-16 encoding.
|
protected void |
encodeNonEmptyFourBitCharacterString(int[] table,
char[] ch,
int offset,
int octetPairLength,
int octetSingleLength) |
|
protected void |
encodeNonEmptyFourBitCharacterStringOnSeventhBit(int[] table,
char[] ch,
int offset,
int length) |
Encode a non empty string on the seventh bit of an octet using a restricted
alphabet that results in the encoding of a character in 4 bits
(or two characters per octet).
|
protected void |
encodeNonEmptyNBitCharacterStringOnSeventhBit(java.lang.String alphabet,
char[] ch,
int offset,
int length) |
Encode a non empty string on the seventh bit of an octet using a restricted
alphabet table.
|
protected void |
encodeNonEmptyOctetStringOnSecondBit(java.lang.String s) |
Encode a non empty string on the second bit of an octet using the UTF-8
encoding.
|
protected void |
encodeNonEmptyUTF8StringAsOctetString(int b,
char[] ch,
int offset,
int length,
int[] constants) |
Encode a non empty string using the UTF-8 encoding.
|
protected void |
encodeNonEmptyUTF8StringAsOctetString(int b,
java.lang.String s,
int[] constants) |
Encode a non empty string using the UTF-8 encoding.
|
protected void |
encodeNonIdentifyingStringOnFirstBit(char[] ch,
int offset,
int length,
CharArrayIntMap map,
boolean addToTable,
boolean clone) |
Encode a non identifying string on the first bit of an octet.
|
protected void |
encodeNonIdentifyingStringOnFirstBit(int id,
int[] table,
java.lang.String s,
boolean addToTable,
boolean mustBeAddedToTable) |
|
protected void |
encodeNonIdentifyingStringOnFirstBit(java.lang.String URI,
int id,
java.lang.Object data) |
Encode a non identifying string on the first bit of an octet as binary
data using an encoding algorithm.
|
protected void |
encodeNonIdentifyingStringOnFirstBit(java.lang.String s,
CharArrayIntMap map,
boolean addToTable) |
Encode a non identifying string on the first bit of an octet.
|
protected void |
encodeNonIdentifyingStringOnFirstBit(java.lang.String s,
StringIntMap map,
boolean addToTable,
boolean mustBeAddedToTable) |
Encode a non identifying string on the first bit of an octet.
|
protected void |
encodeNonIdentifyingStringOnThirdBit(char[] ch,
int offset,
int length,
CharArrayIntMap map,
boolean addToTable,
boolean clone) |
Encode a non identifying string on the third bit of an octet.
|
protected void |
encodeNonIdentifyingStringOnThirdBit(java.lang.String URI,
int id,
byte[] d,
int offset,
int length) |
Encode a non identifying string on the third bit of an octet as binary
data using an encoding algorithm.
|
protected void |
encodeNonIdentifyingStringOnThirdBit(java.lang.String URI,
int id,
java.lang.Object data) |
Encode a non identifying string on the third bit of an octet as binary
data using an encoding algorithm.
|
protected void |
encodeNonZeroInteger(int b,
int i,
int[] constants) |
Encode a non zero integer.
|
protected void |
encodeNonZeroIntegerOnFourthBit(int i) |
Encode a non zero integer on the fourth bit of an octet.
|
protected void |
encodeNonZeroIntegerOnSecondBitFirstBitOne(int i) |
Encode a non zero integer on the second bit of an octet, setting
the first bit to 1.
|
protected void |
encodeNonZeroIntegerOnSecondBitFirstBitZero(int i) |
Encode a non zero integer on the second bit of an octet, setting
the first bit to 0.
|
protected void |
encodeNonZeroIntegerOnThirdBit(int i) |
Encode a non zero integer on the third bit of an octet.
|
protected void |
encodeNonZeroOctetStringLength(int b,
int length,
int[] constants) |
Encode the length of non empty UTF-8 encoded string.
|
protected void |
encodeNonZeroOctetStringLengthOnFifthBit(int length) |
Encode the length of a UTF-8 or UTF-16 encoded string on the fifth bit
of an octet.
|
protected void |
encodeNonZeroOctetStringLengthOnSecondBit(int length) |
Encode the length of a UTF-8 encoded string on the second bit of an octet.
|
protected void |
encodeNonZeroOctetStringLengthOnSenventhBit(int length) |
Encode the length of a encoded string on the seventh bit
of an octet.
|
protected void |
encodeNumericFourBitCharacters(char[] ch,
int offset,
int length,
boolean addToTable) |
Encode a chunk of Character Information Items using a numeric
alphabet that results in the encoding of a character in 4 bits
(or two characters per octet).
|
protected void |
encodeNumericNonIdentifyingStringOnFirstBit(java.lang.String s,
boolean addToTable,
boolean mustBeAddedToTable) |
|
protected void |
encodeProcessingInstruction(java.lang.String target,
java.lang.String data) |
Encode a Processing Instruction Information Item.
|
protected void |
encodeTermination() |
Encode a termination if required.
|
protected int |
encodeUtf16String(char[] ch,
int offset,
int length) |
Encode a string using the UTF-16 encoding.
|
protected int |
encodeUtf16String(java.lang.String s) |
Encode a string using the UTF-16 encoding.
|
protected int |
encodeUTF8String(char[] ch,
int offset,
int length) |
Encode a string using the UTF-8 encoding.
|
protected int |
encodeUTF8String(java.lang.String s) |
Encode a string using the UTF-8 encoding.
|
int |
getAttributeValueMapMemoryLimit() |
Gets the limit on the memory size of Map of attribute values
that will be indexed.
|
int |
getCharacterContentChunkMapMemoryLimit() |
Gets the limit on the memory size, allocated for indexed character
content chunks.
|
java.lang.String |
getCharacterEncodingScheme() |
Gets the character encoding scheme.
|
boolean |
getIgnoreComments() |
|
boolean |
getIgnoreDTD() |
|
boolean |
getIgnoreProcesingInstructions() |
|
boolean |
getIgnoreWhiteSpaceTextContent() |
|
int |
getMaxAttributeValueSize() |
Gets the maximum size of attribute values
that will be indexed.
|
int |
getMaxCharacterContentChunkSize() |
Gets the maximum size of character content chunks
that might be indexed.
|
int |
getMinAttributeValueSize() |
Gets the minimum size of attribute values
that will be indexed.
|
int |
getMinCharacterContentChunkSize() |
Gets the minimum size of character content chunks
that will be indexed.
|
static java.lang.String |
getPrefixFromQualifiedName(java.lang.String qName) |
Obtain the prefix from a qualified name.
|
java.util.Map |
getRegisteredEncodingAlgorithms() |
Gets the set of registered encoding algorithms.
|
VocabularyApplicationData |
getVocabularyApplicationData() |
Get the application data associated with the serializer vocabulary.
|
protected boolean |
hasMark() |
|
boolean |
isAttributeValueLengthMatchesLimit(int length) |
Checks whether attribute value (its length) matches length limit
|
boolean |
isCharacterContentChunkLengthMatchesLimit(int length) |
Checks whether character content chunk (its length) matches length limit
|
static boolean |
isWhiteSpace(char[] ch,
int start,
int length) |
Check if character array contains characters that are all white space.
|
static boolean |
isWhiteSpace(java.lang.String s) |
Check if a String contains characters that are all white space.
|
protected void |
mark() |
Mark the current position in the buffered stream.
|
void |
reset() |
Reset the encoder for reuse encoding another XML infoset.
|
protected void |
resetMark() |
Reset the marked position in the buffered stream.
|
void |
setAttributeValueMapMemoryLimit(int size) |
Sets the limit on the memory size of Map of attribute values
that will be indexed.
|
void |
setCharacterContentChunkMapMemoryLimit(int size) |
Sets the limit on the memory size, allocated for indexed character
content chunks.
|
void |
setCharacterEncodingScheme(java.lang.String characterEncodingScheme) |
Sets the character encoding scheme.
|
void |
setExternalVocabulary(ExternalVocabulary v) |
Set the external vocabulary that shall be used when serializing.
|
void |
setIgnoreComments(boolean ignoreComments) |
|
void |
setIgnoreDTD(boolean ignoreDTD) |
|
void |
setIgnoreProcesingInstructions(boolean ignoreProcesingInstructions) |
|
void |
setIgnoreWhiteSpaceTextContent(boolean ignoreWhiteSpaceTextContent) |
|
void |
setMaxAttributeValueSize(int size) |
Sets the maximum size of attribute values
that will be indexed.
|
void |
setMaxCharacterContentChunkSize(int size) |
Sets the maximum size of character content chunks
that might be indexed.
|
void |
setMinAttributeValueSize(int size) |
Sets the minimum size of attribute values
that will be indexed.
|
void |
setMinCharacterContentChunkSize(int size) |
Sets the minimum size of character content chunks
that will be indexed.
|
void |
setOutputStream(java.io.OutputStream s) |
Set the OutputStream to encode the XML infoset to a
fast infoset document.
|
void |
setRegisteredEncodingAlgorithms(java.util.Map algorithms) |
Sets the set of registered encoding algorithms.
|
void |
setVocabulary(SerializerVocabulary vocabulary) |
Set the SerializerVocabulary to be used for encoding.
|
void |
setVocabularyApplicationData(VocabularyApplicationData data) |
Set the application data to be associated with the serializer vocabulary.
|
protected void |
write(byte[] b,
int length) |
Write an array of bytes to the buffered stream.
|
protected void |
write(byte[] b,
int offset,
int length) |
Write an array of bytes to the buffered stream.
|
protected void |
write(int i) |
Write a byte to the buffered stream.
|
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
public static final java.lang.String CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY
protected static final java.lang.String _characterEncodingSchemeSystemDefault
protected SerializerVocabulary _v
protected VocabularyApplicationData _vData
protected boolean _terminate
protected int _b
protected java.io.OutputStream _s
OutputStream
that the encoded XML infoset (the
fast infoset document) is written to.protected char[] _charBuffer
protected byte[] _octetBuffer
protected int _octetBufferIndex
protected int _markIndex
If the value of the mark is < 0 then the mark is not set.
protected int minAttributeValueSize
protected int maxAttributeValueSize
protected int attributeValueMapTotalCharactersConstraint
protected int minCharacterContentChunkSize
protected int maxCharacterContentChunkSize
protected int characterContentChunkMapTotalCharactersConstraint
protected Encoder()
protected Encoder(boolean useLocalNameAsKeyForQualifiedNameLookup)
public final void setIgnoreDTD(boolean ignoreDTD)
setIgnoreDTD
in interface FastInfosetSerializer
ignoreDTD
- true if the feature shall be ignored.public final boolean getIgnoreDTD()
getIgnoreDTD
in interface FastInfosetSerializer
public final void setIgnoreComments(boolean ignoreComments)
setIgnoreComments
in interface FastInfosetSerializer
ignoreComments
- true if the feature shall be ignored.public final boolean getIgnoreComments()
getIgnoreComments
in interface FastInfosetSerializer
public final void setIgnoreProcesingInstructions(boolean ignoreProcesingInstructions)
setIgnoreProcesingInstructions
in interface FastInfosetSerializer
ignoreProcesingInstructions
- true if the feature shall be ignored.public final boolean getIgnoreProcesingInstructions()
getIgnoreProcesingInstructions
in interface FastInfosetSerializer
public final void setIgnoreWhiteSpaceTextContent(boolean ignoreWhiteSpaceTextContent)
setIgnoreWhiteSpaceTextContent
in interface FastInfosetSerializer
ignoreWhiteSpaceTextContent
- true if the feature shall be ignored.public final boolean getIgnoreWhiteSpaceTextContent()
getIgnoreWhiteSpaceTextContent
in interface FastInfosetSerializer
public void setCharacterEncodingScheme(java.lang.String characterEncodingScheme)
setCharacterEncodingScheme
in interface FastInfosetSerializer
characterEncodingScheme
- The set of registered algorithms.public java.lang.String getCharacterEncodingScheme()
getCharacterEncodingScheme
in interface FastInfosetSerializer
public void setRegisteredEncodingAlgorithms(java.util.Map algorithms)
setRegisteredEncodingAlgorithms
in interface FastInfosetSerializer
algorithms
- The set of registered algorithms.public java.util.Map getRegisteredEncodingAlgorithms()
getRegisteredEncodingAlgorithms
in interface FastInfosetSerializer
public int getMinCharacterContentChunkSize()
getMinCharacterContentChunkSize
in interface FastInfosetSerializer
public void setMinCharacterContentChunkSize(int size)
setMinCharacterContentChunkSize
in interface FastInfosetSerializer
size
- the minimum character content chunk size.public int getMaxCharacterContentChunkSize()
getMaxCharacterContentChunkSize
in interface FastInfosetSerializer
public void setMaxCharacterContentChunkSize(int size)
setMaxCharacterContentChunkSize
in interface FastInfosetSerializer
size
- the maximum character content chunk size.public int getCharacterContentChunkMapMemoryLimit()
getCharacterContentChunkMapMemoryLimit
in interface FastInfosetSerializer
public void setCharacterContentChunkMapMemoryLimit(int size)
setCharacterContentChunkMapMemoryLimit
in interface FastInfosetSerializer
size
- the limit on the memory size, allocated for indexed character
content chunks.public boolean isCharacterContentChunkLengthMatchesLimit(int length)
length
- the length of character content chunk is checking to be added to Map.public boolean canAddCharacterContentToTable(int length, CharArrayIntMap map)
length
- the length of character content chunk is checking to be added to Map.map
- the custom CharArrayIntMap, which memory limits will be checked.public int getMinAttributeValueSize()
getMinAttributeValueSize
in interface FastInfosetSerializer
public void setMinAttributeValueSize(int size)
setMinAttributeValueSize
in interface FastInfosetSerializer
size
- the minimum attribute values size.public int getMaxAttributeValueSize()
getMaxAttributeValueSize
in interface FastInfosetSerializer
public void setMaxAttributeValueSize(int size)
setMaxAttributeValueSize
in interface FastInfosetSerializer
size
- the maximum attribute values size.public void setAttributeValueMapMemoryLimit(int size)
setAttributeValueMapMemoryLimit
in interface FastInfosetSerializer
size
- The attribute value size limit. Any value less
that a length of size limit will be indexed.public int getAttributeValueMapMemoryLimit()
getAttributeValueMapMemoryLimit
in interface FastInfosetSerializer
public boolean isAttributeValueLengthMatchesLimit(int length)
length
- the length of attributepublic boolean canAddAttributeToTable(int length)
length
- the length of attribute value is checking to be added to Map.public void setExternalVocabulary(ExternalVocabulary v)
setExternalVocabulary
in interface FastInfosetSerializer
v
- the vocabulary.public void setVocabularyApplicationData(VocabularyApplicationData data)
setVocabularyApplicationData
in interface FastInfosetSerializer
data
- the application data.public VocabularyApplicationData getVocabularyApplicationData()
getVocabularyApplicationData
in interface FastInfosetSerializer
public void reset()
reset
in interface FastInfosetSerializer
public void setOutputStream(java.io.OutputStream s)
setOutputStream
in interface FastInfosetSerializer
s
- the OutputStream where the fast infoset document is written to.public void setVocabulary(SerializerVocabulary vocabulary)
vocabulary
- the vocabulary to be used for encoding.protected final void encodeHeader(boolean encodeXmlDecl) throws java.io.IOException
encodeXmlDecl
- true if the XML declaration should be encoded.java.io.IOException
protected final void encodeInitialVocabulary() throws java.io.IOException
java.io.IOException
protected final void encodeDocumentTermination() throws java.io.IOException
java.io.IOException
protected final void encodeElementTermination() throws java.io.IOException
java.io.IOException
protected final void encodeTermination() throws java.io.IOException
java.io.IOException
protected final void encodeNamespaceAttribute(java.lang.String prefix, java.lang.String uri) throws java.io.IOException
prefix
- the prefix of the namespace declaration,
if "" then there is no prefix for the namespace declaration.uri
- the URI of the namespace declaration,
if "" then there is no URI for the namespace declaration.java.io.IOException
protected final void encodeCharacters(char[] ch, int offset, int length) throws java.io.IOException
ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.java.io.IOException
protected final void encodeCharactersNoClone(char[] ch, int offset, int length) throws java.io.IOException
Encoder#characterContentChunkSizeContraint
) then the array is not cloned
when adding the array to the vocabulary.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.java.io.IOException
protected final void encodeNumericFourBitCharacters(char[] ch, int offset, int length, boolean addToTable) throws FastInfosetException, java.io.IOException
id
- the restricted alphabet identifier.table
- the table mapping characters to 4 bit values.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.addToTable
- if characters should be added to table.FastInfosetException
java.io.IOException
protected final void encodeDateTimeFourBitCharacters(char[] ch, int offset, int length, boolean addToTable) throws FastInfosetException, java.io.IOException
id
- the restricted alphabet identifier.table
- the table mapping characters to 4 bit values.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.addToTable
- if characters should be added to table.FastInfosetException
java.io.IOException
protected final void encodeFourBitCharacters(int id, int[] table, char[] ch, int offset, int length, boolean addToTable) throws FastInfosetException, java.io.IOException
id
- the restricted alphabet identifier.table
- the table mapping characters to 4 bit values.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.addToTable
- if characters should be added to table.FastInfosetException
java.io.IOException
protected final void encodeAlphabetCharacters(java.lang.String alphabet, char[] ch, int offset, int length, boolean addToTable) throws FastInfosetException, java.io.IOException
alphabet
- the alphabet defining the mapping between characters and
integer values.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.addToTable
- if characters should be added to tableFastInfosetException
- if the alphabet is not present in the
vocabulary.java.io.IOException
protected final void encodeProcessingInstruction(java.lang.String target, java.lang.String data) throws java.io.IOException
target
- the target of the processing instruction.data
- the data of the processing instruction.java.io.IOException
protected final void encodeDocumentTypeDeclaration(java.lang.String systemId, java.lang.String publicId) throws java.io.IOException
systemId
- the system identifier of the external subset.publicId
- the public identifier of the external subset.java.io.IOException
protected final void encodeComment(char[] ch, int offset, int length) throws java.io.IOException
ch
- the array of characters that is as comment.offset
- the offset into the array of characters.length
- the length of characters.java.io.IOException
protected final void encodeCommentNoClone(char[] ch, int offset, int length) throws java.io.IOException
Encoder#characterContentChunkSizeContraint
) then
the array is not cloned when adding the array to the vocabulary.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.java.io.IOException
protected final void encodeElementQualifiedNameOnThirdBit(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName) throws java.io.IOException
The index of the qualified name will be encoded if the name is present
in the vocabulary otherwise the qualified name will be encoded literally
(see encodeLiteralElementQualifiedNameOnThirdBit(java.lang.String, java.lang.String, java.lang.String, com.sun.xml.fastinfoset.util.LocalNameQualifiedNamesMap.Entry)
).
namespaceURI
- the namespace URI of the qualified name.prefix
- the prefix of the qualified name.localName
- the local name of the qualified name.java.io.IOException
protected final void encodeLiteralElementQualifiedNameOnThirdBit(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName, LocalNameQualifiedNamesMap.Entry entry) throws java.io.IOException
namespaceURI
- the namespace URI of the qualified name.prefix
- the prefix of the qualified name.localName
- the local name of the qualified name.java.io.IOException
protected final void encodeAttributeQualifiedNameOnSecondBit(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName) throws java.io.IOException
The index of the qualified name will be encoded if the name is present
in the vocabulary otherwise the qualified name will be encoded literally
(see encodeLiteralAttributeQualifiedNameOnSecondBit(java.lang.String, java.lang.String, java.lang.String, com.sun.xml.fastinfoset.util.LocalNameQualifiedNamesMap.Entry)
).
namespaceURI
- the namespace URI of the qualified name.prefix
- the prefix of the qualified name.localName
- the local name of the qualified name.java.io.IOException
protected final boolean encodeLiteralAttributeQualifiedNameOnSecondBit(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName, LocalNameQualifiedNamesMap.Entry entry) throws java.io.IOException
namespaceURI
- the namespace URI of the qualified name.prefix
- the prefix of the qualified name.localName
- the local name of the qualified name.java.io.IOException
protected final void encodeNonIdentifyingStringOnFirstBit(java.lang.String s, StringIntMap map, boolean addToTable, boolean mustBeAddedToTable) throws java.io.IOException
s
- the string to encodemap
- the vocabulary table of strings to indexes.addToTable
- true if the string could be added to the vocabulary
table (if table has enough memory)mustBeAddedToTable
- true if the string must be added to the vocabulary
table (if not already present in the table).java.io.IOException
protected final void encodeNonIdentifyingStringOnFirstBit(java.lang.String s, CharArrayIntMap map, boolean addToTable) throws java.io.IOException
s
- the string to encodemap
- the vocabulary table of character arrays to indexes.addToTable
- true if the string should be added to the vocabulary
table (if not already present in the table).java.io.IOException
protected final void encodeNonIdentifyingStringOnFirstBit(char[] ch, int offset, int length, CharArrayIntMap map, boolean addToTable, boolean clone) throws java.io.IOException
ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.map
- the vocabulary table of character arrays to indexes.addToTable
- true if the string should be added to the vocabulary
table (if not already present in the table).clone
- true if the array of characters should be cloned if added
to the vocabulary table.java.io.IOException
protected final void encodeNumericNonIdentifyingStringOnFirstBit(java.lang.String s, boolean addToTable, boolean mustBeAddedToTable) throws java.io.IOException, FastInfosetException
java.io.IOException
FastInfosetException
protected final void encodeDateTimeNonIdentifyingStringOnFirstBit(java.lang.String s, boolean addToTable, boolean mustBeAddedToTable) throws java.io.IOException, FastInfosetException
java.io.IOException
FastInfosetException
protected final void encodeNonIdentifyingStringOnFirstBit(int id, int[] table, java.lang.String s, boolean addToTable, boolean mustBeAddedToTable) throws java.io.IOException, FastInfosetException
java.io.IOException
FastInfosetException
protected final void encodeNonIdentifyingStringOnFirstBit(java.lang.String URI, int id, java.lang.Object data) throws FastInfosetException, java.io.IOException
URI
- the encoding algorithm URI. If the URI == null then the
encoding algorithm identifier takes precendence.id
- the encoding algorithm identifier.data
- the data to be encoded using an encoding algorithm.EncodingAlgorithmException
- if the encoding algorithm URI is not
present in the vocabulary, or the encoding algorithm identifier
is not with the required range.FastInfosetException
java.io.IOException
protected final void encodeAIIOctetAlgorithmData(int id, byte[] d, int offset, int length) throws java.io.IOException
id
- the encoding algorithm identifier.d
- the data, as an array of bytes, to be encoded.offset
- the offset into the array of bytes.length
- the length of bytes.java.io.IOException
protected final void encodeAIIObjectAlgorithmData(int id, java.lang.Object data, EncodingAlgorithm ea) throws FastInfosetException, java.io.IOException
id
- the encoding algorithm identifier.data
- the data to be encoded using an encoding algorithm.ea
- the encoding algorithm to use to encode the data into an
array of bytes.FastInfosetException
java.io.IOException
protected final void encodeAIIBuiltInAlgorithmData(int id, java.lang.Object data, int offset, int length) throws java.io.IOException
id
- the built in encoding algorithm identifier.data
- the data to be encoded using an encoding algorithm. The data
represents an array of items specified by the encoding algorithm
identifieroffset
- the offset into the array of bytes.length
- the length of bytes.java.io.IOException
protected final void encodeNonIdentifyingStringOnThirdBit(char[] ch, int offset, int length, CharArrayIntMap map, boolean addToTable, boolean clone) throws java.io.IOException
ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.map
- the vocabulary table of character arrays to indexes.addToTable
- true if the array of characters should be added to the vocabulary
table (if not already present in the table).clone
- true if the array of characters should be cloned if added
to the vocabulary table.java.io.IOException
protected final void encodeNonIdentifyingStringOnThirdBit(java.lang.String URI, int id, java.lang.Object data) throws FastInfosetException, java.io.IOException
URI
- the encoding algorithm URI. If the URI == null then the
encoding algorithm identifier takes precendence.id
- the encoding algorithm identifier.data
- the data to be encoded using an encoding algorithm.EncodingAlgorithmException
- if the encoding algorithm URI is not
present in the vocabulary, or the encoding algorithm identifier
is not with the required range.FastInfosetException
java.io.IOException
protected final void encodeNonIdentifyingStringOnThirdBit(java.lang.String URI, int id, byte[] d, int offset, int length) throws FastInfosetException, java.io.IOException
URI
- the encoding algorithm URI. If the URI == null then the
encoding algorithm identifier takes precendence.id
- the encoding algorithm identifier.d
- the data, as an array of bytes, to be encoded.offset
- the offset into the array of bytes.length
- the length of bytes.EncodingAlgorithmException
- if the encoding algorithm URI is not
present in the vocabulary.FastInfosetException
java.io.IOException
protected final void encodeCIIOctetAlgorithmData(int id, byte[] d, int offset, int length) throws java.io.IOException
id
- the encoding algorithm identifier.d
- the data, as an array of bytes, to be encoded.offset
- the offset into the array of bytes.length
- the length of bytes.java.io.IOException
protected final void encodeCIIObjectAlgorithmData(int id, java.lang.Object data, EncodingAlgorithm ea) throws FastInfosetException, java.io.IOException
id
- the encoding algorithm identifier.data
- the data to be encoded using an encoding algorithm.ea
- the encoding algorithm to use to encode the data into an
array of bytes.FastInfosetException
java.io.IOException
protected final void encodeCIIBuiltInAlgorithmData(int id, java.lang.Object data, int offset, int length) throws FastInfosetException, java.io.IOException
id
- the built in encoding algorithm identifier.data
- the data to be encoded using an encoding algorithm. The data
represents an array of items specified by the encoding algorithm
identifieroffset
- the offset into the array of bytes.length
- the length of bytes.FastInfosetException
java.io.IOException
protected final void encodeCIIBuiltInAlgorithmDataAsCDATA(char[] ch, int offset, int length) throws FastInfosetException, java.io.IOException
ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.FastInfosetException
java.io.IOException
protected final void encodeIdentifyingNonEmptyStringOnFirstBit(java.lang.String s, StringIntMap map) throws java.io.IOException
s
- the identifying string.map
- the vocabulary table to use to determin the index of the
identifying stringjava.io.IOException
protected final void encodeNonEmptyOctetStringOnSecondBit(java.lang.String s) throws java.io.IOException
s
- the string.java.io.IOException
protected final void encodeNonZeroOctetStringLengthOnSecondBit(int length) throws java.io.IOException
length
- the length to encode.java.io.IOException
protected final void encodeNonEmptyCharacterStringOnFifthBit(java.lang.String s) throws java.io.IOException
s
- the string.java.io.IOException
protected final void encodeNonEmptyCharacterStringOnFifthBit(char[] ch, int offset, int length) throws java.io.IOException
ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.java.io.IOException
protected final void encodeNonZeroOctetStringLengthOnFifthBit(int length) throws java.io.IOException
length
- the length to encode.java.io.IOException
protected final void encodeNonEmptyCharacterStringOnSeventhBit(char[] ch, int offset, int length) throws java.io.IOException
ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.java.io.IOException
protected final void encodeNonEmptyFourBitCharacterStringOnSeventhBit(int[] table, char[] ch, int offset, int length) throws FastInfosetException, java.io.IOException
table
- the table mapping characters to 4 bit values.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.FastInfosetException
java.io.IOException
protected final void encodeNonEmptyFourBitCharacterString(int[] table, char[] ch, int offset, int octetPairLength, int octetSingleLength) throws FastInfosetException, java.io.IOException
FastInfosetException
java.io.IOException
protected final void encodeNonEmptyNBitCharacterStringOnSeventhBit(java.lang.String alphabet, char[] ch, int offset, int length) throws FastInfosetException, java.io.IOException
alphabet
- the alphabet defining the mapping between characters and
integer values.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.FastInfosetException
java.io.IOException
protected final void encodeNonZeroOctetStringLengthOnSenventhBit(int length) throws java.io.IOException
length
- the length to encode.java.io.IOException
protected final void encodeNonZeroIntegerOnSecondBitFirstBitOne(int i) throws java.io.IOException
The first bit of the first octet is set, as specified in clause C.13 of ITU-T Rec. X.891 | ISO/IEC 24824-1
i
- The integer to encode, which is a member of the interval
[0, 1048575]. In the specification the interval is [1, 1048576]java.io.IOException
protected final void encodeNonZeroIntegerOnSecondBitFirstBitZero(int i) throws java.io.IOException
The first bit of the first octet is set, as specified in clause C.13 of ITU-T Rec. X.891 | ISO/IEC 24824-1
i
- The integer to encode, which is a member of the interval
[0, 1048575]. In the specification the interval is [1, 1048576]java.io.IOException
protected final void encodeNonZeroIntegerOnThirdBit(int i) throws java.io.IOException
i
- The integer to encode, which is a member of the interval
[0, 1048575]. In the specification the interval is [1, 1048576]java.io.IOException
protected final void encodeNonZeroIntegerOnFourthBit(int i) throws java.io.IOException
i
- The integer to encode, which is a member of the interval
[0, 1048575]. In the specification the interval is [1, 1048576]java.io.IOException
protected final void encodeNonEmptyUTF8StringAsOctetString(int b, java.lang.String s, int[] constants) throws java.io.IOException
b
- the current octet that is being written.s
- the string to be UTF-8 encoded.constants
- the array of constants to use when encoding to determin
how the length of the UTF-8 encoded string is encoded.java.io.IOException
protected final void encodeNonEmptyUTF8StringAsOctetString(int b, char[] ch, int offset, int length, int[] constants) throws java.io.IOException
b
- the current octet that is being written.ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.
how the length of the UTF-8 encoded string is encoded.constants
- the array of constants to use when encoding to determin
how the length of the UTF-8 encoded string is encoded.java.io.IOException
protected final void encodeNonZeroOctetStringLength(int b, int length, int[] constants) throws java.io.IOException
b
- the current octet that is being written.length
- the length of the UTF-8 encoded string.
how the length of the UTF-8 encoded string is encoded.constants
- the array of constants to use when encoding to determin
how the length of the UTF-8 encoded string is encoded.java.io.IOException
protected final void encodeNonZeroInteger(int b, int i, int[] constants) throws java.io.IOException
b
- the current octet that is being written.i
- the non zero integer.constants
- the array of constants to use when encoding to determin
how the non zero integer is encoded.java.io.IOException
protected final void mark()
protected final void resetMark()
protected final boolean hasMark()
protected final void write(int i) throws java.io.IOException
java.io.IOException
protected final void write(byte[] b, int length) throws java.io.IOException
b
- the array of bytes.length
- the length of bytes.java.io.IOException
protected final void write(byte[] b, int offset, int length) throws java.io.IOException
b
- the array of bytes.offset
- the offset into the array of bytes.length
- the length of bytes.java.io.IOException
protected final int encodeUTF8String(java.lang.String s) throws java.io.IOException
s
- the string to encode.java.io.IOException
protected final int encodeUTF8String(char[] ch, int offset, int length) throws java.io.IOException
ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.java.io.IOException
protected final int encodeUtf16String(java.lang.String s) throws java.io.IOException
s
- the string to encode.java.io.IOException
protected final int encodeUtf16String(char[] ch, int offset, int length) throws java.io.IOException
ch
- the array of characters.offset
- the offset into the array of characters.length
- the length of characters.java.io.IOException
public static java.lang.String getPrefixFromQualifiedName(java.lang.String qName)
qName
- the qualified namepublic static boolean isWhiteSpace(char[] ch, int start, int length)
ch
- the character arraystart
- the starting character index into the array to check fromlength
- the number of characters to checkpublic static boolean isWhiteSpace(java.lang.String s)
s
- the stringCopyright © 2018 Oracle Corporation. All rights reserved.