Concrete implementations extending Encoder will utilize methods on Encoder to encode XML infoset according to the Fast Infoset standard. It is the responsibility of the concrete implementation to ensure that methods are invoked in the correct order to produce a valid fast infoset document.
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 java. is
supported in a similar manner to a java..
Combining buffering with encoding enables better performance.
More than one fast infoset document may be encoded to the
java..
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| protected int | _b
The current octet that is to be written. |
| private int | |
| protected static final 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. |
| private byte[] | |
| private int | |
| private final Encoder. | |
| private boolean | _encodingStringsAsUtf8
True if strings for text content and attribute values will be UTF-8 encoded otherwise they will be UTF-16 encoded. |
| private boolean | _ignoreComments
True if comments shall be ignored. |
| private boolean | _ignoreDTD
True if DTD and internal subset shall be ignored. |
| private boolean | _ignoreProcessingInstructions
True if procesing instructions shall be ignored. |
| private boolean | _ignoreWhiteSpaceTextContent
True if white space characters for text content shall be ignored. |
| protected int | _markIndex
The current mark in the internal buffer. |
| private int | _nonIdentifyingStringOnFirstBitCES
Encoding constant generated from the string encoding. |
| private int | _nonIdentifyingStringOnThirdBitCES
Encoding constant generated from the string encoding. |
| protected byte[] | _octetBuffer
The internal buffer of bytes. |
| protected int | _octetBufferIndex
The current position in the internal buffer. |
| private Map | _registeredEncodingAlgorithms
The map of URIs to algorithms. |
| protected OutputStream | _s
The |
| protected boolean | _terminate
True if terminatation of an information item is required |
| private boolean | _useLocalNameAsKeyForQualifiedNameLookup
True, if the local name string is used as the key to find the associated set of qualified names. |
| protected SerializerVocabulary | _v
The vocabulary that is used by the encoder |
| protected VocabularyApplicationData | _vData
The vocabulary application data that is used by the encoder |
| private boolean | _vIsInternal
True if the vocubulary is internal to the encoder |
| protected int | attributeValueMapTotalCharactersConstraint
The limit on the size of indexed Map for attribute values Limit is measured in characters number |
| public static final 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 |
| private static int[] | |
| 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. |
| private static int[] |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public boolean | Returns: whether attribute map has enough memorythe length of attribute value is checking to be added to Map. length)Checks whether attribute table has enough memory to store attribute value with the given length |
| public boolean | Returns: whether character content map has enough memorythe length of character content chunk is checking to be added to Map. length, CharArrayIntMap the custom CharArrayIntMap, which memory limits will be checked. map)Checks whether character content table has enough memory to store character content chunk with the given length |
| protected final void | encodeAIIBuiltInAlgorithmData(int
the built in encoding algorithm identifier. id, Object the data to be encoded using an encoding algorithm. The data
represents an array of items specified by the encoding algorithm
identifier data, int the offset into the array of bytes. offset, int the length of bytes. length)Encode the [normalized value] of an Attribute Information Item using using a built in encoding algorithm.Implementation of clause C.14 of ITU-T Rec. |
| protected final void | encodeAIIObjectAlgorithmData(int
the encoding algorithm identifier. id, Object the data to be encoded using an encoding algorithm. data, EncodingAlgorithm the encoding algorithm to use to encode the data into an
array of bytes. ea)Encode the [normalized value] of an Attribute Information Item using using an encoding algorithm.Implementation of clause C.14 of ITU-T Rec.X.891 | ISO/IEC 24824-1. |
| protected final void | encodeAIIOctetAlgorithmData(int
the encoding algorithm identifier. id, byte[] the data, as an array of bytes, to be encoded. d, int the offset into the array of bytes. offset, int the length of bytes. length)Encode the [normalized value] of an Attribute Information Item using using an encoding algorithm.Implementation of clause C.14 of ITU-T Rec. |
| protected final void | encodeAlphabetCharacters(String
the alphabet defining the mapping between characters and
integer values. alphabet, char[] the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length, boolean if characters should be added to table addToTable)Encode a chunk of Character Information Items using a restricted alphabet table. |
| protected final void | encodeAttributeQualifiedNameOnSecondBit(String
the namespace URI of the qualified name. namespaceURI, String the prefix of the qualified name. prefix, String the local name of the qualified name. localName)Encode a qualified name of an Attribute Informaiton Item on the third bit of an octet.Implementation of clause C.17 of ITU-T Rec. |
| private void | |
| protected final void | encodeCharacters(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a chunk of Character Information Items. |
| protected final void | encodeCharactersNoClone(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a chunk of Character Information Items. |
| protected final void | encodeCIIBuiltInAlgorithmData(int
the built in encoding algorithm identifier. id, Object the data to be encoded using an encoding algorithm. The data
represents an array of items specified by the encoding algorithm
identifier data, int the offset into the array of bytes. offset, int the length of bytes. length)Encode a chunk of Character Information Items using using an encoding algorithm.Implementation of clause C.15 of ITU-T Rec.X.891 | ISO/IEC 24824-1. |
| protected final void | encodeCIIBuiltInAlgorithmDataAsCDATA(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a chunk of Character Information Items using using the CDATA built in encoding algorithm.Implementation of clause C.15 of ITU-T Rec.X.891 | ISO/IEC 24824-1. |
| protected final void | encodeCIIObjectAlgorithmData(int
the encoding algorithm identifier. id, Object the data to be encoded using an encoding algorithm. data, EncodingAlgorithm the encoding algorithm to use to encode the data into an
array of bytes. ea)Encode a chunk of Character Information Items using using an encoding algorithm.Implementation of clause C.15 of ITU-T Rec.X.891 | ISO/IEC 24824-1. |
| protected final void | encodeCIIOctetAlgorithmData(int
the encoding algorithm identifier. id, byte[] the data, as an array of bytes, to be encoded. d, int the offset into the array of bytes. offset, int the length of bytes. length)Encode a chunk of Character Information Items using using an encoding algorithm.Implementation of clause C.15 of ITU-T Rec. |
| protected final void | encodeComment(char[]
the array of characters that is as comment. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a Comment Information Item. |
| protected final void | encodeCommentNoClone(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a Comment Information Item.If the array of characters that is a
comment is to be indexed (as determined by
|
| protected final void | encodeDateTimeFourBitCharacters(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length, boolean if characters should be added to table. 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 final void | encodeDateTimeNonIdentifyingStringOnFirstBit(String s, boolean addToTable, boolean mustBeAddedToTable)
|
| protected final void | |
| protected final void | encodeDocumentTypeDeclaration(String
the system identifier of the external subset. systemId, String the public identifier of the external subset. publicId)Encode a Document Type Declaration. |
| protected final void | encodeElementQualifiedNameOnThirdBit(String
the namespace URI of the qualified name. namespaceURI, String the prefix of the qualified name. prefix, String the local name of the qualified name. localName)Encode a qualified name of an Element Information Item on the third bit of an octet.Implementation of clause C.18 of ITU-T Rec. |
| protected final void | |
| protected final void | encodeFourBitCharacters(int
the restricted alphabet identifier. id, int[] the table mapping characters to 4 bit values. table, char[] the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length, boolean if characters should be added to table. 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 final void | encodeHeader(boolean
true if the XML declaration should be encoded. encodeXmlDecl)Encode the header of a fast infoset document. |
| protected final void | encodeIdentifyingNonEmptyStringOnFirstBit(String
the identifying string. s, StringIntMap the vocabulary table to use to determin the index of the
identifying string map)Encode a non empty identifying string on the first bit of an octet.Implementation of clause C.13 of ITU-T Rec. |
| protected final void | |
| protected final boolean | Returns: localName the local name of the qualified name.the namespace URI of the qualified name. namespaceURI, String the prefix of the qualified name. prefix, String the local name of the qualified name. localName, LocalNameQualifiedNamesMap.Encode a literal qualified name of an Attribute InforImplementation of clause C.17 of ITU-T Rec.maiton IX.891 | ISO/IEC 24824-1.ause C.17 of ITU-T Rec.X.891 | ISO/IEC 24824-1. |
| protected final void | encodeLiteralElementQualifiedNameOnThirdBit(String
the namespace URI of the qualified name. namespaceURI, String the prefix of the qualified name. prefix, String localName, LocalNameQualifiedNamesMap.Encode a literal qualified name of an Element InforImplementation of clause C.18 of ITU-T Rec.maiton IX.891 | ISO/IEC 24824-1.ause C.18 of ITU-T Rec.X.891 | ISO/IEC 24824-1. |
| protected final void | encodeNamespaceAttribute(String
the prefix of the namespace declaration,
if "" then there is no prefix for the namespace declaration. prefix, String the URI of the namespace declaration,
if "" then there is no URI for the namespace declaration. uri)Encode a Attribute Information Item that is a namespace declaration. |
| protected final void | encodeNonEmptyCharacterStringOnFifthBit(String
the string. s)Encode a non empty string on the fifth bit of an octet using the UTF-8 or UTF-16 encoding.Implementation of clause C.23 of ITU-T Rec. |
| protected final void | encodeNonEmptyCharacterStringOnFifthBit(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a non empty string on the fifth bit of an octet using the UTF-8 or UTF-16 encoding.Implementation of clause C.23 of ITU-T Rec. |
| protected final void | encodeNonEmptyCharacterStringOnSeventhBit(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a non empty string on the seventh bit of an octet using the UTF-8 or UTF-16 encoding.Implementation of clause C.24 of ITU-T Rec. |
| protected final void | encodeNonEmptyFourBitCharacterString(int[] table, char[] ch, int offset, int octetPairLength, int octetSingleLength)
|
| protected final void | encodeNonEmptyFourBitCharacterStringOnSeventhBit(int[]
the table mapping characters to 4 bit values. table, char[] the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. 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).Implementation of clause C.24 of ITU-T Rec.X.891 | ISO/IEC 24824-1. |
| protected final void | encodeNonEmptyNBitCharacterStringOnSeventhBit(String
the alphabet defining the mapping between characters and
integer values. alphabet, char[] the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a non empty string on the seventh bit of an octet using a restricted alphabet table.Implementation of clause C.24 of ITU-T Rec.X.891 | ISO/IEC 24824-1. |
| protected final void | encodeNonEmptyOctetStringOnSecondBit(String
the string. s)Encode a non empty string on the second bit of an octet using the UTF-8 encoding.Implementation of clause C.22 of ITU-T Rec. |
| protected final void | encodeNonEmptyUTF8StringAsOctetString(int
the current octet that is being written. b, String the string to be UTF-8 encoded. s, int[] the array of constants to use when encoding to determin
how the length of the UTF-8 encoded string is encoded. constants)Encode a non empty string using the UTF-8 encoding. |
| protected final void | encodeNonEmptyUTF8StringAsOctetString(int
the current octet that is being written. b, char[] the array of characters. ch, int the offset into the array of characters. offset, int the length of characters.
how the length of the UTF-8 encoded string is encoded. length, int[] the array of constants to use when encoding to determin
how the length of the UTF-8 encoded string is encoded. constants)Encode a non empty string using the UTF-8 encoding. |
| protected final void | encodeNonIdentifyingStringOnFirstBit(String
the string to encode s, StringIntMap the vocabulary table of strings to indexes. map, boolean true if the string could be added to the vocabulary
table (if table has enough memory) addToTable, boolean true if the string must be added to the vocabulary
table (if not already present in the table). mustBeAddedToTable)Encode a non identifying string on the first bit of an octet.Implementation of clause C.14 of ITU-T Rec. |
| protected final void | encodeNonIdentifyingStringOnFirstBit(String
the string to encode s, CharArrayIntMap the vocabulary table of character arrays to indexes. map, boolean true if the string should be added to the vocabulary
table (if not already present in the table). addToTable)Encode a non identifying string on the first bit of an octet.Implementation of clause C.14 of ITU-T Rec. |
| protected final void | encodeNonIdentifyingStringOnFirstBit(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length, CharArrayIntMap the vocabulary table of character arrays to indexes. map, boolean true if the string should be added to the vocabulary
table (if not already present in the table). addToTable, boolean true if the array of characters should be cloned if added
to the vocabulary table. clone)Encode a non identifying string on the first bit of an octet.Implementation of clause C.14 of ITU-T Rec. |
| protected final void | encodeNonIdentifyingStringOnFirstBit(int id, int[] table, String s, boolean addToTable, boolean mustBeAddedToTable)
|
| protected final void | encodeNonIdentifyingStringOnFirstBit(String
the encoding algorithm URI. If the URI == null then the
encoding algorithm identifier takes precendence. URI, int the encoding algorithm identifier. id, Object the data to be encoded using an encoding algorithm. data)Encode a non identifying string on the first bit of an octet as binary data using an encoding algorithm.Implementation of clause C.14 of ITU-T Rec. |
| protected final void | encodeNonIdentifyingStringOnThirdBit(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length, CharArrayIntMap the vocabulary table of character arrays to indexes. map, boolean true if the array of characters should be added to the vocabulary
table (if not already present in the table). addToTable, boolean true if the array of characters should be cloned if added
to the vocabulary table. clone)Encode a non identifying string on the third bit of an octet.Implementation of clause C.15 of ITU-T Rec. |
| protected final void | encodeNonIdentifyingStringOnThirdBit(String
the encoding algorithm URI. If the URI == null then the
encoding algorithm identifier takes precendence. URI, int the encoding algorithm identifier. id, Object the data to be encoded using an encoding algorithm. data)Encode a non identifying string on the third bit of an octet as binary data using an encoding algorithm.Implementation of clause C.15 of ITU-T Rec. |
| protected final void | encodeNonIdentifyingStringOnThirdBit(String
the encoding algorithm URI. If the URI == null then the
encoding algorithm identifier takes precendence. URI, int the encoding algorithm identifier. id, byte[] the data, as an array of bytes, to be encoded. d, int the offset into the array of bytes. offset, int the length of bytes. length)Encode a non identifying string on the third bit of an octet as binary data using an encoding algorithm.Implementation of clause C.15 of ITU-T Rec. |
| protected final void | encodeNonZeroInteger(int
the current octet that is being written. b, int the non zero integer. i, int[] the array of constants to use when encoding to determin
how the non zero integer is encoded. constants)Encode a non zero integer. |
| protected final void | encodeNonZeroIntegerOnFourthBit(int
The integer to encode, which is a member of the interval
[0, 1048575]. In the specification the interval is [1, 1048576] i)Encode a non zero integer on the fourth bit of an octet.Implementation of clause C.28 of ITU-T Rec. |
| protected final void | encodeNonZeroIntegerOnSecondBitFirstBitOne(int
The integer to encode, which is a member of the interval [0,
1048575]. In the specification the interval is [1, 1048576] i)Encode a non zero integer on the second bit of an octet, setting the first bit to 1.Implementation of clause C.24 of ITU-T Rec. |
| protected final void | encodeNonZeroIntegerOnSecondBitFirstBitZero(int
The integer to encode, which is a member of the interval [0,
1048575]. In the specification the interval is [1, 1048576] i)Encode a non zero integer on the second bit of an octet, setting the first bit to 0.Implementation of clause C.25 of ITU-T Rec. |
| protected final void | encodeNonZeroIntegerOnThirdBit(int
The integer to encode, which is a member of the interval
[0, 1048575]. In the specification the interval is [1, 1048576] i)Encode a non zero integer on the third bit of an octet.Implementation of clause C.27 of ITU-T Rec. |
| protected final void | encodeNonZeroOctetStringLength(int
the current octet that is being written. b, int the length of the UTF-8 encoded string.
how the length of the UTF-8 encoded string is encoded. length, int[] the array of constants to use when encoding to determin
how the length of the UTF-8 encoded string is encoded. constants)Encode the length of non empty UTF-8 encoded string. |
| protected final void | encodeNonZeroOctetStringLengthOnFifthBit(int
the length to encode. length)Encode the length of a UTF-8 or UTF-16 encoded string on the fifth bit of an octet.Implementation of clause C.23 of ITU-T Rec. |
| protected final void | encodeNonZeroOctetStringLengthOnSecondBit(int
the length to encode. length)Encode the length of a UTF-8 encoded string on the second bit of an octet.Implementation of clause C.22 of ITU-T Rec. |
| protected final void | encodeNonZeroOctetStringLengthOnSenventhBit(int
the length to encode. length)Encode the length of a encoded string on the seventh bit of an octet.Implementation of clause C.24 of ITU-T Rec. |
| protected final void | encodeNumericFourBitCharacters(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length, boolean if characters should be added to table. 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 final void | encodeNumericNonIdentifyingStringOnFirstBit(String s, boolean addToTable, boolean mustBeAddedToTable)
|
| protected final void | encodeProcessingInstruction(String
the target of the processing instruction. target, String the data of the processing instruction. data)Encode a Processing Instruction Information Item. |
| protected final void | |
| protected final int | |
| protected final int | encodeUtf16String(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a string using the UTF-16 encoding. |
| protected final int | |
| protected final int | encodeUTF8String(char[]
the array of characters. ch, int the offset into the array of characters. offset, int the length of characters. length)Encode a string using the UTF-8 encoding. |
| private void | |
| private void | |
| private void | |
| public int | getAttributeValueMapMemoryLimit()
Implements org. Gets the limit on the memory size of Map of attribute values that will be indexed. |
| public int | getCharacterContentChunkMapMemoryLimit()
Implements org. Gets the limit on the memory size, allocated for indexed character content chunks. |
| public String | getCharacterEncodingScheme()
Implements org. Gets the character encoding scheme. |
| private static String | |
| public final boolean | |
| public final boolean | getIgnoreDTD()
Implements org. Get the |
| public final boolean | |
| public final boolean | |
| public int | getMaxAttributeValueSize()
Implements org. Gets the maximum size of attribute values that will be indexed. |
| public int | getMaxCharacterContentChunkSize()
Implements org. Gets the maximum size of character content chunks that might be indexed. |
| public int | getMinAttributeValueSize()
Implements org. Gets the minimum size of attribute values that will be indexed. |
| public int | getMinCharacterContentChunkSize()
Implements org. Gets the minimum size of character content chunks that will be indexed. |
| public static String | Returns: the prefix, or "" if there is no prefix.the qualified name qName)Obtain the prefix from a qualified name. |
| public Map | getRegisteredEncodingAlgorithms()
Implements org. Gets the set of registered encoding algorithms. |
| public VocabularyApplicationData | getVocabularyApplicationData()
Implements org. Get the application data associated with the serializer vocabulary. |
| protected final boolean | |
| public boolean | Returns: whether attribute value matches limitthe length of attribute length)Checks whether attribute value (its length) matches length limit |
| public boolean | Returns: whether character content chunk length matches limitthe length of character content chunk is checking to be added to Map. length)Checks whether character content chunk (its length) matches length limit |
| public static boolean | Returns: true if all characters are white space, false otherwisethe character array ch, int the starting character index into the array to check from start, final int the number of characters to check length)Check if character array contains characters that are all white space. |
| public static boolean | Returns: true if all characters are white space, false otherwisethe string s)Check if a String contains characters that are all white space. |
| protected final void | |
| private static int | |
| public void | reset()
Implements org. Reset the encoder for reuse encoding another XML infoset. |
| private void | |
| protected final void | |
| private void | |
| public void | setAttributeValueMapMemoryLimit(int size)
Implements org. Sets the limit on the memory size of Map of attribute values that will be indexed. |
| public void | setCharacterContentChunkMapMemoryLimit(int size)
Implements org. Sets the limit on the memory size, allocated for indexed character content chunks. |
| public final void | setCharacterEncodingScheme(String characterEncodingScheme)
Implements org. Sets the character encoding scheme. |
| public void | setExternalVocabulary(ExternalVocabulary v)
Implements org. Set the external vocabulary that shall be used when serializing. |
| public final void | setIgnoreComments(boolean ignoreComments)
Implements org. Set the |
| public final void | setIgnoreDTD(boolean ignoreDTD)
Implements org. Set the |
| public final void | setIgnoreProcesingInstructions(boolean ignoreProcesingInstructions)
Implements org. |
| public final void | setIgnoreWhiteSpaceTextContent(boolean ignoreWhiteSpaceTextContent)
Implements org. |
| public void | setMaxAttributeValueSize(int size)
Implements org. Sets the maximum size of attribute values that will be indexed. |
| public void | setMaxCharacterContentChunkSize(int size)
Implements org. Sets the maximum size of character content chunks that might be indexed. |
| public void | setMinAttributeValueSize(int size)
Implements org. Sets the minimum size of attribute values that will be indexed. |
| public void | setMinCharacterContentChunkSize(int size)
Implements org. Sets the minimum size of character content chunks that will be indexed. |
| public void | setOutputStream(OutputStream
the OutputStream where the fast infoset document is written to. s)Implements org. Set the OutputStream to encode the XML infoset to a fast infoset document. |
| public void | setRegisteredEncodingAlgorithms(final Map<String, EncodingAlgorithm> algorithms)
Implements org. Sets the set of registered encoding algorithms. |
| public void | setVocabulary(SerializerVocabulary
the vocabulary to be used for encoding. vocabulary)Set the SerializerVocabulary to be used for encoding. |
| public void | setVocabularyApplicationData(VocabularyApplicationData data)
Implements org. Set the application data to be associated with the serializer vocabulary. |
| protected final void | |
| protected final void | write(byte[]
the array of bytes. b, int the length of bytes. length)Write an array of bytes to the buffered stream. |
| protected final void | write(byte[]
the array of bytes. b, int the offset into the array of bytes. offset, int the length of bytes. length)Write an array of bytes to the buffered stream. |
| private void |