Class Encoder
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- com.sun.xml.fastinfoset.Encoder
-
- All Implemented Interfaces:
FastInfosetSerializer,org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler
- Direct Known Subclasses:
DOMDocumentSerializer,SAXDocumentSerializer,StAXDocumentSerializer
public abstract class Encoder extends org.xml.sax.helpers.DefaultHandler implements FastInfosetSerializer
Abstract encoder for developing concrete encoders. 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
OutputStreamis supported in a similar manner to aBufferedOutputStream. Combining buffering with encoding enables better performance.More than one fast infoset document may be encoded to the
OutputStream.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classEncoder.EncodingBufferOutputStream
-
Field Summary
Fields Modifier and Type Field Description protected int_bThe current octet that is to be written.private int_bitsLeftInOctetprotected static java.lang.String_characterEncodingSchemeSystemDefaultDefault character encoding scheme system property for the encoding of content and attribute values.protected char[]_charBufferThe internal buffer of characters used for the UTF-8 or UTF-16 encoding of characters.private byte[]_encodingBufferprivate int_encodingBufferIndexprivate Encoder.EncodingBufferOutputStream_encodingBufferOutputStreamprivate boolean_encodingStringsAsUtf8True if strings for text content and attribute values will be UTF-8 encoded otherwise they will be UTF-16 encoded.private boolean_ignoreCommentsTrue if comments shall be ignored.private boolean_ignoreDTDTrue if DTD and internal subset shall be ignored.private boolean_ignoreProcessingInstructionsTrue if procesing instructions shall be ignored.private boolean_ignoreWhiteSpaceTextContentTrue if white space characters for text content shall be ignored.protected int_markIndexThe current mark in the internal buffer.private int_nonIdentifyingStringOnFirstBitCESEncoding constant generated from the string encoding.private int_nonIdentifyingStringOnThirdBitCESEncoding constant generated from the string encoding.protected byte[]_octetBufferThe internal buffer of bytes.protected int_octetBufferIndexThe current position in the internal buffer.private java.util.Map_registeredEncodingAlgorithmsThe map of URIs to algorithms.protected java.io.OutputStream_sTheOutputStreamthat the encoded XML infoset (the fast infoset document) is written to.protected boolean_terminateTrue if terminatation of an information item is requiredprivate boolean_useLocalNameAsKeyForQualifiedNameLookupTrue, if the local name string is used as the key to find the associated set of qualified names.protected SerializerVocabulary_vThe vocabulary that is used by the encoderprotected VocabularyApplicationData_vDataThe vocabulary application data that is used by the encoderprivate boolean_vIsInternalTrue if the vocubulary is internal to the encoderprotected intattributeValueMapTotalCharactersConstraintThe limit on the size of indexed Map for attribute values Limit is measured in characters numberstatic java.lang.StringCHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTYCharacter encoding scheme system property for the encoding of content and attribute values.protected intcharacterContentChunkMapTotalCharactersConstraintThe limit on the size of indexed Map for character content chunks Limit is measured in characters numberprivate static int[]DATE_TIME_CHARACTERS_TABLEprotected intmaxAttributeValueSizeThe maximum size of [normalized value] of Attribute Information Items that will be indexed.protected intmaxCharacterContentChunkSizeThe maximum size of character content chunks of Character Information Items or Comment Information Items that will be indexed.protected intminAttributeValueSizeThe minimum size of [normalized value] of Attribute Information Items that will be indexed.protected intminCharacterContentChunkSizeThe minimum size of character content chunks of Character Information Items or Comment Information Items that will be indexed.private static int[]NUMERIC_CHARACTERS_TABLE-
Fields inherited from interface org.jvnet.fastinfoset.FastInfosetSerializer
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_flush()booleancanAddAttributeToTable(int length)Checks whether attribute table has enough memory to store attribute value with the given lengthbooleancanAddCharacterContentToTable(int length, CharArrayIntMap map)Checks whether character content table has enough memory to store character content chunk with the given lengthprotected voidencodeAIIBuiltInAlgorithmData(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 voidencodeAIIObjectAlgorithmData(int id, java.lang.Object data, EncodingAlgorithm ea)Encode the [normalized value] of an Attribute Information Item using using an encoding algorithm.protected voidencodeAIIOctetAlgorithmData(int id, byte[] d, int offset, int length)Encode the [normalized value] of an Attribute Information Item using using an encoding algorithm.protected voidencodeAlphabetCharacters(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 voidencodeAttributeQualifiedNameOnSecondBit(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.private voidencodeCharacterAsUtf8FourByte(int c, char[] ch, int chpos, int chend, int bpos)protected voidencodeCharacters(char[] ch, int offset, int length)Encode a chunk of Character Information Items.protected voidencodeCharactersNoClone(char[] ch, int offset, int length)Encode a chunk of Character Information Items.protected voidencodeCIIBuiltInAlgorithmData(int id, java.lang.Object data, int offset, int length)Encode a chunk of Character Information Items using using an encoding algorithm.protected voidencodeCIIBuiltInAlgorithmDataAsCDATA(char[] ch, int offset, int length)Encode a chunk of Character Information Items using using the CDATA built in encoding algorithm.protected voidencodeCIIObjectAlgorithmData(int id, java.lang.Object data, EncodingAlgorithm ea)Encode a chunk of Character Information Items using using an encoding algorithm.protected voidencodeCIIOctetAlgorithmData(int id, byte[] d, int offset, int length)Encode a chunk of Character Information Items using using an encoding algorithm.protected voidencodeComment(char[] ch, int offset, int length)Encode a Comment Information Item.protected voidencodeCommentNoClone(char[] ch, int offset, int length)Encode a Comment Information Item.protected voidencodeDateTimeFourBitCharacters(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 voidencodeDateTimeNonIdentifyingStringOnFirstBit(java.lang.String s, boolean addToTable, boolean mustBeAddedToTable)protected voidencodeDocumentTermination()Encode the termination of the Document Information Item.protected voidencodeDocumentTypeDeclaration(java.lang.String systemId, java.lang.String publicId)Encode a Document Type Declaration.protected voidencodeElementQualifiedNameOnThirdBit(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 voidencodeElementTermination()Encode the termination of an Element Information Item.protected voidencodeFourBitCharacters(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 voidencodeHeader(boolean encodeXmlDecl)Encode the header of a fast infoset document.protected voidencodeIdentifyingNonEmptyStringOnFirstBit(java.lang.String s, StringIntMap map)Encode a non empty identifying string on the first bit of an octet.protected voidencodeInitialVocabulary()Encode the initial vocabulary of a fast infoset document.protected booleanencodeLiteralAttributeQualifiedNameOnSecondBit(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 voidencodeLiteralElementQualifiedNameOnThirdBit(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 voidencodeNamespaceAttribute(java.lang.String prefix, java.lang.String uri)Encode a Attribute Information Item that is a namespace declaration.protected voidencodeNonEmptyCharacterStringOnFifthBit(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 voidencodeNonEmptyCharacterStringOnFifthBit(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 voidencodeNonEmptyCharacterStringOnSeventhBit(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 voidencodeNonEmptyFourBitCharacterString(int[] table, char[] ch, int offset, int octetPairLength, int octetSingleLength)protected voidencodeNonEmptyFourBitCharacterStringOnSeventhBit(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 voidencodeNonEmptyNBitCharacterStringOnSeventhBit(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 voidencodeNonEmptyOctetStringOnSecondBit(java.lang.String s)Encode a non empty string on the second bit of an octet using the UTF-8 encoding.protected voidencodeNonEmptyUTF8StringAsOctetString(int b, char[] ch, int offset, int length, int[] constants)Encode a non empty string using the UTF-8 encoding.protected voidencodeNonEmptyUTF8StringAsOctetString(int b, java.lang.String s, int[] constants)Encode a non empty string using the UTF-8 encoding.protected voidencodeNonIdentifyingStringOnFirstBit(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 voidencodeNonIdentifyingStringOnFirstBit(int id, int[] table, java.lang.String s, boolean addToTable, boolean mustBeAddedToTable)protected voidencodeNonIdentifyingStringOnFirstBit(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 voidencodeNonIdentifyingStringOnFirstBit(java.lang.String s, CharArrayIntMap map, boolean addToTable)Encode a non identifying string on the first bit of an octet.protected voidencodeNonIdentifyingStringOnFirstBit(java.lang.String s, StringIntMap map, boolean addToTable, boolean mustBeAddedToTable)Encode a non identifying string on the first bit of an octet.protected voidencodeNonIdentifyingStringOnThirdBit(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 voidencodeNonIdentifyingStringOnThirdBit(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 voidencodeNonIdentifyingStringOnThirdBit(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 voidencodeNonZeroInteger(int b, int i, int[] constants)Encode a non zero integer.protected voidencodeNonZeroIntegerOnFourthBit(int i)Encode a non zero integer on the fourth bit of an octet.protected voidencodeNonZeroIntegerOnSecondBitFirstBitOne(int i)Encode a non zero integer on the second bit of an octet, setting the first bit to 1.protected voidencodeNonZeroIntegerOnSecondBitFirstBitZero(int i)Encode a non zero integer on the second bit of an octet, setting the first bit to 0.protected voidencodeNonZeroIntegerOnThirdBit(int i)Encode a non zero integer on the third bit of an octet.protected voidencodeNonZeroOctetStringLength(int b, int length, int[] constants)Encode the length of non empty UTF-8 encoded string.protected voidencodeNonZeroOctetStringLengthOnFifthBit(int length)Encode the length of a UTF-8 or UTF-16 encoded string on the fifth bit of an octet.protected voidencodeNonZeroOctetStringLengthOnSecondBit(int length)Encode the length of a UTF-8 encoded string on the second bit of an octet.protected voidencodeNonZeroOctetStringLengthOnSenventhBit(int length)Encode the length of a encoded string on the seventh bit of an octet.protected voidencodeNumericFourBitCharacters(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 voidencodeNumericNonIdentifyingStringOnFirstBit(java.lang.String s, boolean addToTable, boolean mustBeAddedToTable)protected voidencodeProcessingInstruction(java.lang.String target, java.lang.String data)Encode a Processing Instruction Information Item.protected voidencodeTermination()Encode a termination if required.protected intencodeUtf16String(char[] ch, int offset, int length)Encode a string using the UTF-16 encoding.protected intencodeUtf16String(java.lang.String s)Encode a string using the UTF-16 encoding.protected intencodeUTF8String(char[] ch, int offset, int length)Encode a string using the UTF-8 encoding.protected intencodeUTF8String(java.lang.String s)Encode a string using the UTF-8 encoding.private voidensureEncodingBufferSizeForUtf16String(int length)private voidensureEncodingBufferSizeForUtf8String(int length)private voidensureSize(int length)intgetAttributeValueMapMemoryLimit()Gets the limit on the memory size of Map of attribute values that will be indexed.intgetCharacterContentChunkMapMemoryLimit()Gets the limit on the memory size, allocated for indexed character content chunks.java.lang.StringgetCharacterEncodingScheme()Gets the character encoding scheme.private static java.lang.StringgetDefaultEncodingScheme()booleangetIgnoreComments()booleangetIgnoreDTD()booleangetIgnoreProcesingInstructions()booleangetIgnoreWhiteSpaceTextContent()intgetMaxAttributeValueSize()Gets the maximum size of attribute values that will be indexed.intgetMaxCharacterContentChunkSize()Gets the maximum size of character content chunks that might be indexed.intgetMinAttributeValueSize()Gets the minimum size of attribute values that will be indexed.intgetMinCharacterContentChunkSize()Gets the minimum size of character content chunks that will be indexed.static java.lang.StringgetPrefixFromQualifiedName(java.lang.String qName)Obtain the prefix from a qualified name.java.util.MapgetRegisteredEncodingAlgorithms()Gets the set of registered encoding algorithms.VocabularyApplicationDatagetVocabularyApplicationData()Get the application data associated with the serializer vocabulary.protected booleanhasMark()booleanisAttributeValueLengthMatchesLimit(int length)Checks whether attribute value (its length) matches length limitbooleanisCharacterContentChunkLengthMatchesLimit(int length)Checks whether character content chunk (its length) matches length limitstatic booleanisWhiteSpace(char[] ch, int start, int length)Check if character array contains characters that are all white space.static booleanisWhiteSpace(java.lang.String s)Check if a String contains characters that are all white space.protected voidmark()Mark the current position in the buffered stream.private static intmaxCharacter(java.lang.String alphabet)voidreset()Reset the encoder for reuse encoding another XML infoset.private voidresetBits()protected voidresetMark()Reset the marked position in the buffered stream.private voidresize(int length)voidsetAttributeValueMapMemoryLimit(int size)Sets the limit on the memory size of Map of attribute values that will be indexed.voidsetCharacterContentChunkMapMemoryLimit(int size)Sets the limit on the memory size, allocated for indexed character content chunks.voidsetCharacterEncodingScheme(java.lang.String characterEncodingScheme)Sets the character encoding scheme.voidsetExternalVocabulary(ExternalVocabulary v)Set the external vocabulary that shall be used when serializing.voidsetIgnoreComments(boolean ignoreComments)voidsetIgnoreDTD(boolean ignoreDTD)voidsetIgnoreProcesingInstructions(boolean ignoreProcesingInstructions)voidsetIgnoreWhiteSpaceTextContent(boolean ignoreWhiteSpaceTextContent)voidsetMaxAttributeValueSize(int size)Sets the maximum size of attribute values that will be indexed.voidsetMaxCharacterContentChunkSize(int size)Sets the maximum size of character content chunks that might be indexed.voidsetMinAttributeValueSize(int size)Sets the minimum size of attribute values that will be indexed.voidsetMinCharacterContentChunkSize(int size)Sets the minimum size of character content chunks that will be indexed.voidsetOutputStream(java.io.OutputStream s)Set the OutputStream to encode the XML infoset to a fast infoset document.voidsetRegisteredEncodingAlgorithms(java.util.Map algorithms)Sets the set of registered encoding algorithms.voidsetVocabulary(SerializerVocabulary vocabulary)Set the SerializerVocabulary to be used for encoding.voidsetVocabularyApplicationData(VocabularyApplicationData data)Set the application data to be associated with the serializer vocabulary.protected voidwrite(byte[] b, int length)Write an array of bytes to the buffered stream.protected voidwrite(byte[] b, int offset, int length)Write an array of bytes to the buffered stream.protected voidwrite(int i)Write a byte to the buffered stream.private voidwriteBits(int bits, int v)-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY
public static final java.lang.String CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY
Character encoding scheme system property for the encoding of content and attribute values.- See Also:
- Constant Field Values
-
_characterEncodingSchemeSystemDefault
protected static final java.lang.String _characterEncodingSchemeSystemDefault
Default character encoding scheme system property for the encoding of content and attribute values.
-
NUMERIC_CHARACTERS_TABLE
private static int[] NUMERIC_CHARACTERS_TABLE
-
DATE_TIME_CHARACTERS_TABLE
private static int[] DATE_TIME_CHARACTERS_TABLE
-
_ignoreDTD
private boolean _ignoreDTD
True if DTD and internal subset shall be ignored.
-
_ignoreComments
private boolean _ignoreComments
True if comments shall be ignored.
-
_ignoreProcessingInstructions
private boolean _ignoreProcessingInstructions
True if procesing instructions shall be ignored.
-
_ignoreWhiteSpaceTextContent
private boolean _ignoreWhiteSpaceTextContent
True if white space characters for text content shall be ignored.
-
_useLocalNameAsKeyForQualifiedNameLookup
private boolean _useLocalNameAsKeyForQualifiedNameLookup
True, if the local name string is used as the key to find the associated set of qualified names.False, if the
: string is used as the key to find the associated set of qualified names.
-
_encodingStringsAsUtf8
private boolean _encodingStringsAsUtf8
True if strings for text content and attribute values will be UTF-8 encoded otherwise they will be UTF-16 encoded.
-
_nonIdentifyingStringOnThirdBitCES
private int _nonIdentifyingStringOnThirdBitCES
Encoding constant generated from the string encoding.
-
_nonIdentifyingStringOnFirstBitCES
private int _nonIdentifyingStringOnFirstBitCES
Encoding constant generated from the string encoding.
-
_registeredEncodingAlgorithms
private java.util.Map _registeredEncodingAlgorithms
The map of URIs to algorithms.
-
_v
protected SerializerVocabulary _v
The vocabulary that is used by the encoder
-
_vData
protected VocabularyApplicationData _vData
The vocabulary application data that is used by the encoder
-
_vIsInternal
private boolean _vIsInternal
True if the vocubulary is internal to the encoder
-
_terminate
protected boolean _terminate
True if terminatation of an information item is required
-
_b
protected int _b
The current octet that is to be written.
-
_s
protected java.io.OutputStream _s
TheOutputStreamthat the encoded XML infoset (the fast infoset document) is written to.
-
_charBuffer
protected char[] _charBuffer
The internal buffer of characters used for the UTF-8 or UTF-16 encoding of characters.
-
_octetBuffer
protected byte[] _octetBuffer
The internal buffer of bytes.
-
_octetBufferIndex
protected int _octetBufferIndex
The current position in the internal buffer.
-
_markIndex
protected int _markIndex
The current mark in the internal buffer.If the value of the mark is < 0 then the mark is not set.
-
minAttributeValueSize
protected int minAttributeValueSize
The minimum size of [normalized value] of Attribute Information Items that will be indexed.
-
maxAttributeValueSize
protected int maxAttributeValueSize
The maximum size of [normalized value] of Attribute Information Items that will be indexed.
-
attributeValueMapTotalCharactersConstraint
protected int attributeValueMapTotalCharactersConstraint
The limit on the size of indexed Map for attribute values Limit is measured in characters number
-
minCharacterContentChunkSize
protected int minCharacterContentChunkSize
The minimum size of character content chunks of Character Information Items or Comment Information Items that will be indexed.
-
maxCharacterContentChunkSize
protected int maxCharacterContentChunkSize
The maximum size of character content chunks of Character Information Items or Comment Information Items that will be indexed.
-
characterContentChunkMapTotalCharactersConstraint
protected int characterContentChunkMapTotalCharactersConstraint
The limit on the size of indexed Map for character content chunks Limit is measured in characters number
-
_bitsLeftInOctet
private int _bitsLeftInOctet
-
_encodingBufferOutputStream
private Encoder.EncodingBufferOutputStream _encodingBufferOutputStream
-
_encodingBuffer
private byte[] _encodingBuffer
-
_encodingBufferIndex
private int _encodingBufferIndex
-
-
Method Detail
-
getDefaultEncodingScheme
private static java.lang.String getDefaultEncodingScheme()
-
maxCharacter
private static int maxCharacter(java.lang.String alphabet)
-
setIgnoreDTD
public final void setIgnoreDTD(boolean ignoreDTD)
- Specified by:
setIgnoreDTDin interfaceFastInfosetSerializer- Parameters:
ignoreDTD- true if the feature shall be ignored.
-
getIgnoreDTD
public final boolean getIgnoreDTD()
- Specified by:
getIgnoreDTDin interfaceFastInfosetSerializer- Returns:
- true if the feature is ignored, false otherwise.
-
setIgnoreComments
public final void setIgnoreComments(boolean ignoreComments)
- Specified by:
setIgnoreCommentsin interfaceFastInfosetSerializer- Parameters:
ignoreComments- true if the feature shall be ignored.
-
getIgnoreComments
public final boolean getIgnoreComments()
- Specified by:
getIgnoreCommentsin interfaceFastInfosetSerializer- Returns:
- true if the feature is ignored, false otherwise.
-
setIgnoreProcesingInstructions
public final void setIgnoreProcesingInstructions(boolean ignoreProcesingInstructions)
- Specified by:
setIgnoreProcesingInstructionsin interfaceFastInfosetSerializer- Parameters:
ignoreProcesingInstructions- true if the feature shall be ignored.
-
getIgnoreProcesingInstructions
public final boolean getIgnoreProcesingInstructions()
- Specified by:
getIgnoreProcesingInstructionsin interfaceFastInfosetSerializer- Returns:
- true if the feature is ignored, false otherwise.
-
setIgnoreWhiteSpaceTextContent
public final void setIgnoreWhiteSpaceTextContent(boolean ignoreWhiteSpaceTextContent)
- Specified by:
setIgnoreWhiteSpaceTextContentin interfaceFastInfosetSerializer- Parameters:
ignoreWhiteSpaceTextContent- true if the feature shall be ignored.
-
getIgnoreWhiteSpaceTextContent
public final boolean getIgnoreWhiteSpaceTextContent()
- Specified by:
getIgnoreWhiteSpaceTextContentin interfaceFastInfosetSerializer- Returns:
- true if the feature is ignored, false otherwise.
-
setCharacterEncodingScheme
public void setCharacterEncodingScheme(java.lang.String characterEncodingScheme)
Sets the character encoding scheme. The character encoding can be either UTF-8 or UTF-16BE for the the encoding of chunks of CIIs, the [normalized value] property of attribute information items, comment information items and processing instruction information items.- Specified by:
setCharacterEncodingSchemein interfaceFastInfosetSerializer- Parameters:
characterEncodingScheme- The set of registered algorithms.
-
getCharacterEncodingScheme
public java.lang.String getCharacterEncodingScheme()
Gets the character encoding scheme.- Specified by:
getCharacterEncodingSchemein interfaceFastInfosetSerializer- Returns:
- The character encoding scheme.
-
setRegisteredEncodingAlgorithms
public void setRegisteredEncodingAlgorithms(java.util.Map algorithms)
Sets the set of registered encoding algorithms.- Specified by:
setRegisteredEncodingAlgorithmsin interfaceFastInfosetSerializer- Parameters:
algorithms- The set of registered algorithms.
-
getRegisteredEncodingAlgorithms
public java.util.Map getRegisteredEncodingAlgorithms()
Gets the set of registered encoding algorithms.- Specified by:
getRegisteredEncodingAlgorithmsin interfaceFastInfosetSerializer- Returns:
- The set of registered algorithms.
-
getMinCharacterContentChunkSize
public int getMinCharacterContentChunkSize()
Gets the minimum size of character content chunks that will be indexed.- Specified by:
getMinCharacterContentChunkSizein interfaceFastInfosetSerializer- Returns:
- The minimum character content chunk size.
-
setMinCharacterContentChunkSize
public void setMinCharacterContentChunkSize(int size)
Sets the minimum size of character content chunks that will be indexed.- Specified by:
setMinCharacterContentChunkSizein interfaceFastInfosetSerializer- Parameters:
size- the minimum character content chunk size.
-
getMaxCharacterContentChunkSize
public int getMaxCharacterContentChunkSize()
Gets the maximum size of character content chunks that might be indexed.- Specified by:
getMaxCharacterContentChunkSizein interfaceFastInfosetSerializer- Returns:
- The maximum character content chunk size.
-
setMaxCharacterContentChunkSize
public void setMaxCharacterContentChunkSize(int size)
Sets the maximum size of character content chunks that might be indexed.- Specified by:
setMaxCharacterContentChunkSizein interfaceFastInfosetSerializer- Parameters:
size- the maximum character content chunk size.
-
getCharacterContentChunkMapMemoryLimit
public int getCharacterContentChunkMapMemoryLimit()
Gets the limit on the memory size, allocated for indexed character content chunks.- Specified by:
getCharacterContentChunkMapMemoryLimitin interfaceFastInfosetSerializer- Returns:
- the limit on the memory size, allocated for indexed character content chunks.
-
setCharacterContentChunkMapMemoryLimit
public void setCharacterContentChunkMapMemoryLimit(int size)
Sets the limit on the memory size, allocated for indexed character content chunks.- Specified by:
setCharacterContentChunkMapMemoryLimitin interfaceFastInfosetSerializer- Parameters:
size- the limit on the memory size, allocated for indexed character content chunks.
-
isCharacterContentChunkLengthMatchesLimit
public boolean isCharacterContentChunkLengthMatchesLimit(int length)
Checks whether character content chunk (its length) matches length limit- Parameters:
length- the length of character content chunk is checking to be added to Map.- Returns:
- whether character content chunk length matches limit
-
canAddCharacterContentToTable
public boolean canAddCharacterContentToTable(int length, CharArrayIntMap map)Checks whether character content table has enough memory to store character content chunk with the given length- Parameters:
length- the length of character content chunk is checking to be added to Map.map- the custom CharArrayIntMap, which memory limits will be checked.- Returns:
- whether character content map has enough memory
-
getMinAttributeValueSize
public int getMinAttributeValueSize()
Gets the minimum size of attribute values that will be indexed.- Specified by:
getMinAttributeValueSizein interfaceFastInfosetSerializer- Returns:
- The minimum attribute values size.
-
setMinAttributeValueSize
public void setMinAttributeValueSize(int size)
Sets the minimum size of attribute values that will be indexed.- Specified by:
setMinAttributeValueSizein interfaceFastInfosetSerializer- Parameters:
size- the minimum attribute values size.
-
getMaxAttributeValueSize
public int getMaxAttributeValueSize()
Gets the maximum size of attribute values that will be indexed.- Specified by:
getMaxAttributeValueSizein interfaceFastInfosetSerializer- Returns:
- The maximum attribute values size.
-
setMaxAttributeValueSize
public void setMaxAttributeValueSize(int size)
Sets the maximum size of attribute values that will be indexed.- Specified by:
setMaxAttributeValueSizein interfaceFastInfosetSerializer- Parameters:
size- the maximum attribute values size.
-
setAttributeValueMapMemoryLimit
public void setAttributeValueMapMemoryLimit(int size)
Sets the limit on the memory size of Map of attribute values that will be indexed.- Specified by:
setAttributeValueMapMemoryLimitin interfaceFastInfosetSerializer- Parameters:
size- The attribute value size limit. Any value less that a length of size limit will be indexed.
-
getAttributeValueMapMemoryLimit
public int getAttributeValueMapMemoryLimit()
Gets the limit on the memory size of Map of attribute values that will be indexed.- Specified by:
getAttributeValueMapMemoryLimitin interfaceFastInfosetSerializer- Returns:
- The attribute value size limit.
-
isAttributeValueLengthMatchesLimit
public boolean isAttributeValueLengthMatchesLimit(int length)
Checks whether attribute value (its length) matches length limit- Parameters:
length- the length of attribute- Returns:
- whether attribute value matches limit
-
canAddAttributeToTable
public boolean canAddAttributeToTable(int length)
Checks whether attribute table has enough memory to store attribute value with the given length- Parameters:
length- the length of attribute value is checking to be added to Map.- Returns:
- whether attribute map has enough memory
-
setExternalVocabulary
public void setExternalVocabulary(ExternalVocabulary v)
Set the external vocabulary that shall be used when serializing.- Specified by:
setExternalVocabularyin interfaceFastInfosetSerializer- Parameters:
v- the vocabulary.
-
setVocabularyApplicationData
public void setVocabularyApplicationData(VocabularyApplicationData data)
Set the application data to be associated with the serializer vocabulary.- Specified by:
setVocabularyApplicationDatain interfaceFastInfosetSerializer- Parameters:
data- the application data.
-
getVocabularyApplicationData
public VocabularyApplicationData getVocabularyApplicationData()
Get the application data associated with the serializer vocabulary.- Specified by:
getVocabularyApplicationDatain interfaceFastInfosetSerializer- Returns:
- the application data.
-
reset
public void reset()
Reset the encoder for reuse encoding another XML infoset.- Specified by:
resetin interfaceFastInfosetSerializer
-
setOutputStream
public void setOutputStream(java.io.OutputStream s)
Set the OutputStream to encode the XML infoset to a fast infoset document.- Specified by:
setOutputStreamin interfaceFastInfosetSerializer- Parameters:
s- the OutputStream where the fast infoset document is written to.
-
setVocabulary
public void setVocabulary(SerializerVocabulary vocabulary)
Set the SerializerVocabulary to be used for encoding.- Parameters:
vocabulary- the vocabulary to be used for encoding.
-
encodeHeader
protected final void encodeHeader(boolean encodeXmlDecl) throws java.io.IOExceptionEncode the header of a fast infoset document.- Parameters:
encodeXmlDecl- true if the XML declaration should be encoded.- Throws:
java.io.IOException
-
encodeInitialVocabulary
protected final void encodeInitialVocabulary() throws java.io.IOExceptionEncode the initial vocabulary of a fast infoset document.- Throws:
java.io.IOException
-
encodeDocumentTermination
protected final void encodeDocumentTermination() throws java.io.IOExceptionEncode the termination of the Document Information Item.- Throws:
java.io.IOException
-
encodeElementTermination
protected final void encodeElementTermination() throws java.io.IOExceptionEncode the termination of an Element Information Item.- Throws:
java.io.IOException
-
encodeTermination
protected final void encodeTermination() throws java.io.IOExceptionEncode a termination if required.- Throws:
java.io.IOException
-
encodeNamespaceAttribute
protected final void encodeNamespaceAttribute(java.lang.String prefix, java.lang.String uri) throws java.io.IOExceptionEncode a Attribute Information Item that is a namespace declaration.- Parameters:
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.- Throws:
java.io.IOException
-
encodeCharacters
protected final void encodeCharacters(char[] ch, int offset, int length) throws java.io.IOExceptionEncode a chunk of Character Information Items.- Parameters:
ch- the array of characters.offset- the offset into the array of characters.length- the length of characters.- Throws:
java.io.IOException
-
encodeCharactersNoClone
protected final void encodeCharactersNoClone(char[] ch, int offset, int length) throws java.io.IOExceptionEncode a chunk of Character Information Items. If the array of characters is to be indexed (as determined byEncoder#characterContentChunkSizeContraint) then the array is not cloned when adding the array to the vocabulary.- Parameters:
ch- the array of characters.offset- the offset into the array of characters.length- the length of characters.- Throws:
java.io.IOException
-
encodeNumericFourBitCharacters
protected final void encodeNumericFourBitCharacters(char[] ch, int offset, int length, boolean addToTable) throws FastInfosetException, java.io.IOExceptionEncode 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).- Parameters:
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.- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeDateTimeFourBitCharacters
protected final void encodeDateTimeFourBitCharacters(char[] ch, int offset, int length, boolean addToTable) throws FastInfosetException, java.io.IOExceptionEncode 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).- Parameters:
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.- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeFourBitCharacters
protected final void encodeFourBitCharacters(int id, int[] table, char[] ch, int offset, int length, boolean addToTable) throws FastInfosetException, java.io.IOExceptionEncode 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).- Parameters:
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.- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeAlphabetCharacters
protected final void encodeAlphabetCharacters(java.lang.String alphabet, char[] ch, int offset, int length, boolean addToTable) throws FastInfosetException, java.io.IOExceptionEncode a chunk of Character Information Items using a restricted alphabet table.- Parameters:
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 table- Throws:
FastInfosetException- if the alphabet is not present in the vocabulary.java.io.IOException
-
encodeProcessingInstruction
protected final void encodeProcessingInstruction(java.lang.String target, java.lang.String data) throws java.io.IOExceptionEncode a Processing Instruction Information Item.- Parameters:
target- the target of the processing instruction.data- the data of the processing instruction.- Throws:
java.io.IOException
-
encodeDocumentTypeDeclaration
protected final void encodeDocumentTypeDeclaration(java.lang.String systemId, java.lang.String publicId) throws java.io.IOExceptionEncode a Document Type Declaration.- Parameters:
systemId- the system identifier of the external subset.publicId- the public identifier of the external subset.- Throws:
java.io.IOException
-
encodeComment
protected final void encodeComment(char[] ch, int offset, int length) throws java.io.IOExceptionEncode a Comment Information Item.- Parameters:
ch- the array of characters that is as comment.offset- the offset into the array of characters.length- the length of characters.- Throws:
java.io.IOException
-
encodeCommentNoClone
protected final void encodeCommentNoClone(char[] ch, int offset, int length) throws java.io.IOExceptionEncode a Comment Information Item. If the array of characters that is a comment is to be indexed (as determined byEncoder#characterContentChunkSizeContraint) then the array is not cloned when adding the array to the vocabulary.- Parameters:
ch- the array of characters.offset- the offset into the array of characters.length- the length of characters.- Throws:
java.io.IOException
-
encodeElementQualifiedNameOnThirdBit
protected final void encodeElementQualifiedNameOnThirdBit(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName) throws java.io.IOExceptionEncode a qualified name of an Element Informaiton Item on the third bit of an octet. Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1.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)).- Parameters:
namespaceURI- the namespace URI of the qualified name.prefix- the prefix of the qualified name.localName- the local name of the qualified name.- Throws:
java.io.IOException
-
encodeLiteralElementQualifiedNameOnThirdBit
protected final void encodeLiteralElementQualifiedNameOnThirdBit(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName, LocalNameQualifiedNamesMap.Entry entry) throws java.io.IOExceptionEncode a literal qualified name of an Element Informaiton Item on the third bit of an octet. Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
namespaceURI- the namespace URI of the qualified name.prefix- the prefix of the qualified name.localName- the local name of the qualified name.- Throws:
java.io.IOException
-
encodeAttributeQualifiedNameOnSecondBit
protected final void encodeAttributeQualifiedNameOnSecondBit(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName) throws java.io.IOExceptionEncode a qualified name of an Attribute Informaiton Item on the third bit of an octet. Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1.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)).- Parameters:
namespaceURI- the namespace URI of the qualified name.prefix- the prefix of the qualified name.localName- the local name of the qualified name.- Throws:
java.io.IOException
-
encodeLiteralAttributeQualifiedNameOnSecondBit
protected final boolean encodeLiteralAttributeQualifiedNameOnSecondBit(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName, LocalNameQualifiedNamesMap.Entry entry) throws java.io.IOExceptionEncode a literal qualified name of an Attribute Informaiton Item on the third bit of an octet. Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
namespaceURI- the namespace URI of the qualified name.prefix- the prefix of the qualified name.localName- the local name of the qualified name.- Throws:
java.io.IOException
-
encodeNonIdentifyingStringOnFirstBit
protected final void encodeNonIdentifyingStringOnFirstBit(java.lang.String s, StringIntMap map, boolean addToTable, boolean mustBeAddedToTable) throws java.io.IOExceptionEncode a non identifying string on the first bit of an octet. Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
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).- Throws:
java.io.IOException
-
encodeNonIdentifyingStringOnFirstBit
protected final void encodeNonIdentifyingStringOnFirstBit(java.lang.String s, CharArrayIntMap map, boolean addToTable) throws java.io.IOExceptionEncode a non identifying string on the first bit of an octet. Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
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).- Throws:
java.io.IOException
-
encodeNonIdentifyingStringOnFirstBit
protected final void encodeNonIdentifyingStringOnFirstBit(char[] ch, int offset, int length, CharArrayIntMap map, boolean addToTable, boolean clone) throws java.io.IOExceptionEncode a non identifying string on the first bit of an octet. Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
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.- Throws:
java.io.IOException
-
encodeNumericNonIdentifyingStringOnFirstBit
protected final void encodeNumericNonIdentifyingStringOnFirstBit(java.lang.String s, boolean addToTable, boolean mustBeAddedToTable) throws java.io.IOException, FastInfosetException- Throws:
java.io.IOExceptionFastInfosetException
-
encodeDateTimeNonIdentifyingStringOnFirstBit
protected final void encodeDateTimeNonIdentifyingStringOnFirstBit(java.lang.String s, boolean addToTable, boolean mustBeAddedToTable) throws java.io.IOException, FastInfosetException- Throws:
java.io.IOExceptionFastInfosetException
-
encodeNonIdentifyingStringOnFirstBit
protected final void encodeNonIdentifyingStringOnFirstBit(int id, int[] table, java.lang.String s, boolean addToTable, boolean mustBeAddedToTable) throws java.io.IOException, FastInfosetException- Throws:
java.io.IOExceptionFastInfosetException
-
encodeNonIdentifyingStringOnFirstBit
protected final void encodeNonIdentifyingStringOnFirstBit(java.lang.String URI, int id, java.lang.Object data) throws FastInfosetException, java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.- Parameters:
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.- Throws:
EncodingAlgorithmException- if the encoding algorithm URI is not present in the vocabulary, or the encoding algorithm identifier is not with the required range.FastInfosetExceptionjava.io.IOException
-
encodeAIIOctetAlgorithmData
protected final void encodeAIIOctetAlgorithmData(int id, byte[] d, int offset, int length) throws java.io.IOExceptionEncode 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.- Parameters:
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.- Throws:
java.io.IOException
-
encodeAIIObjectAlgorithmData
protected final void encodeAIIObjectAlgorithmData(int id, java.lang.Object data, EncodingAlgorithm ea) throws FastInfosetException, java.io.IOExceptionEncode 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.- Parameters:
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.- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeAIIBuiltInAlgorithmData
protected final void encodeAIIBuiltInAlgorithmData(int id, java.lang.Object data, int offset, int length) throws java.io.IOExceptionEncode the [normalized value] of an Attribute Information Item using using a built in encoding algorithm. Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
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.- Throws:
java.io.IOException
-
encodeNonIdentifyingStringOnThirdBit
protected final void encodeNonIdentifyingStringOnThirdBit(char[] ch, int offset, int length, CharArrayIntMap map, boolean addToTable, boolean clone) throws java.io.IOExceptionEncode a non identifying string on the third bit of an octet. Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
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.- Throws:
java.io.IOException
-
encodeNonIdentifyingStringOnThirdBit
protected final void encodeNonIdentifyingStringOnThirdBit(java.lang.String URI, int id, java.lang.Object data) throws FastInfosetException, java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.- Parameters:
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.- Throws:
EncodingAlgorithmException- if the encoding algorithm URI is not present in the vocabulary, or the encoding algorithm identifier is not with the required range.FastInfosetExceptionjava.io.IOException
-
encodeNonIdentifyingStringOnThirdBit
protected final void encodeNonIdentifyingStringOnThirdBit(java.lang.String URI, int id, byte[] d, int offset, int length) throws FastInfosetException, java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.- Parameters:
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.- Throws:
EncodingAlgorithmException- if the encoding algorithm URI is not present in the vocabulary.FastInfosetExceptionjava.io.IOException
-
encodeCIIOctetAlgorithmData
protected final void encodeCIIOctetAlgorithmData(int id, byte[] d, int offset, int length) throws java.io.IOExceptionEncode 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.- Parameters:
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.- Throws:
java.io.IOException
-
encodeCIIObjectAlgorithmData
protected final void encodeCIIObjectAlgorithmData(int id, java.lang.Object data, EncodingAlgorithm ea) throws FastInfosetException, java.io.IOExceptionEncode 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.- Parameters:
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.- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeCIIBuiltInAlgorithmData
protected final void encodeCIIBuiltInAlgorithmData(int id, java.lang.Object data, int offset, int length) throws FastInfosetException, java.io.IOExceptionEncode 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.- Parameters:
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.- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeCIIBuiltInAlgorithmDataAsCDATA
protected final void encodeCIIBuiltInAlgorithmDataAsCDATA(char[] ch, int offset, int length) throws FastInfosetException, java.io.IOExceptionEncode 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.- Parameters:
ch- the array of characters.offset- the offset into the array of characters.length- the length of characters.- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeIdentifyingNonEmptyStringOnFirstBit
protected final void encodeIdentifyingNonEmptyStringOnFirstBit(java.lang.String s, StringIntMap map) throws java.io.IOExceptionEncode a non empty identifying string on the first bit of an octet. Implementation of clause C.13 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
s- the identifying string.map- the vocabulary table to use to determin the index of the identifying string- Throws:
java.io.IOException
-
encodeNonEmptyOctetStringOnSecondBit
protected final void encodeNonEmptyOctetStringOnSecondBit(java.lang.String s) throws java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.- Parameters:
s- the string.- Throws:
java.io.IOException
-
encodeNonZeroOctetStringLengthOnSecondBit
protected final void encodeNonZeroOctetStringLengthOnSecondBit(int length) throws java.io.IOExceptionEncode the length of a UTF-8 encoded string on the second bit of an octet. Implementation of clause C.22 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
length- the length to encode.- Throws:
java.io.IOException
-
encodeNonEmptyCharacterStringOnFifthBit
protected final void encodeNonEmptyCharacterStringOnFifthBit(java.lang.String s) throws java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.- Parameters:
s- the string.- Throws:
java.io.IOException
-
encodeNonEmptyCharacterStringOnFifthBit
protected final void encodeNonEmptyCharacterStringOnFifthBit(char[] ch, int offset, int length) throws java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.- Parameters:
ch- the array of characters.offset- the offset into the array of characters.length- the length of characters.- Throws:
java.io.IOException
-
encodeNonZeroOctetStringLengthOnFifthBit
protected final void encodeNonZeroOctetStringLengthOnFifthBit(int length) throws java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.- Parameters:
length- the length to encode.- Throws:
java.io.IOException
-
encodeNonEmptyCharacterStringOnSeventhBit
protected final void encodeNonEmptyCharacterStringOnSeventhBit(char[] ch, int offset, int length) throws java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.- Parameters:
ch- the array of characters.offset- the offset into the array of characters.length- the length of characters.- Throws:
java.io.IOException
-
encodeNonEmptyFourBitCharacterStringOnSeventhBit
protected final void encodeNonEmptyFourBitCharacterStringOnSeventhBit(int[] table, char[] ch, int offset, int length) throws FastInfosetException, java.io.IOExceptionEncode 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.- Parameters:
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.- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeNonEmptyFourBitCharacterString
protected final void encodeNonEmptyFourBitCharacterString(int[] table, char[] ch, int offset, int octetPairLength, int octetSingleLength) throws FastInfosetException, java.io.IOException- Throws:
FastInfosetExceptionjava.io.IOException
-
encodeNonEmptyNBitCharacterStringOnSeventhBit
protected final void encodeNonEmptyNBitCharacterStringOnSeventhBit(java.lang.String alphabet, char[] ch, int offset, int length) throws FastInfosetException, java.io.IOExceptionEncode 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.- Parameters:
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.- Throws:
FastInfosetExceptionjava.io.IOException
-
resetBits
private final void resetBits()
-
writeBits
private final void writeBits(int bits, int v) throws java.io.IOException- Throws:
java.io.IOException
-
encodeNonZeroOctetStringLengthOnSenventhBit
protected final void encodeNonZeroOctetStringLengthOnSenventhBit(int length) throws java.io.IOExceptionEncode the length of a encoded string on the seventh bit of an octet. Implementation of clause C.24 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
length- the length to encode.- Throws:
java.io.IOException
-
encodeNonZeroIntegerOnSecondBitFirstBitOne
protected final void encodeNonZeroIntegerOnSecondBitFirstBitOne(int i) throws java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.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
- Parameters:
i- The integer to encode, which is a member of the interval [0, 1048575]. In the specification the interval is [1, 1048576]- Throws:
java.io.IOException
-
encodeNonZeroIntegerOnSecondBitFirstBitZero
protected final void encodeNonZeroIntegerOnSecondBitFirstBitZero(int i) throws java.io.IOExceptionEncode 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. X.891 | ISO/IEC 24824-1.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
- Parameters:
i- The integer to encode, which is a member of the interval [0, 1048575]. In the specification the interval is [1, 1048576]- Throws:
java.io.IOException
-
encodeNonZeroIntegerOnThirdBit
protected final void encodeNonZeroIntegerOnThirdBit(int i) throws java.io.IOExceptionEncode a non zero integer on the third bit of an octet. Implementation of clause C.27 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
i- The integer to encode, which is a member of the interval [0, 1048575]. In the specification the interval is [1, 1048576]- Throws:
java.io.IOException
-
encodeNonZeroIntegerOnFourthBit
protected final void encodeNonZeroIntegerOnFourthBit(int i) throws java.io.IOExceptionEncode a non zero integer on the fourth bit of an octet. Implementation of clause C.28 of ITU-T Rec. X.891 | ISO/IEC 24824-1.- Parameters:
i- The integer to encode, which is a member of the interval [0, 1048575]. In the specification the interval is [1, 1048576]- Throws:
java.io.IOException
-
encodeNonEmptyUTF8StringAsOctetString
protected final void encodeNonEmptyUTF8StringAsOctetString(int b, java.lang.String s, int[] constants) throws java.io.IOExceptionEncode a non empty string using the UTF-8 encoding.- Parameters:
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.- Throws:
java.io.IOException
-
encodeNonEmptyUTF8StringAsOctetString
protected final void encodeNonEmptyUTF8StringAsOctetString(int b, char[] ch, int offset, int length, int[] constants) throws java.io.IOExceptionEncode a non empty string using the UTF-8 encoding.- Parameters:
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.- Throws:
java.io.IOException
-
encodeNonZeroOctetStringLength
protected final void encodeNonZeroOctetStringLength(int b, int length, int[] constants) throws java.io.IOExceptionEncode the length of non empty UTF-8 encoded string.- Parameters:
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.- Throws:
java.io.IOException
-
encodeNonZeroInteger
protected final void encodeNonZeroInteger(int b, int i, int[] constants) throws java.io.IOExceptionEncode a non zero integer.- Parameters:
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.- Throws:
java.io.IOException
-
mark
protected final void mark()
Mark the current position in the buffered stream.
-
resetMark
protected final void resetMark()
Reset the marked position in the buffered stream.
-
hasMark
protected final boolean hasMark()
- Returns:
- true if the mark has been set, otherwise false if the mark has not been set.
-
write
protected final void write(int i) throws java.io.IOExceptionWrite a byte to the buffered stream.- Throws:
java.io.IOException
-
write
protected final void write(byte[] b, int length) throws java.io.IOExceptionWrite an array of bytes to the buffered stream.- Parameters:
b- the array of bytes.length- the length of bytes.- Throws:
java.io.IOException
-
write
protected final void write(byte[] b, int offset, int length) throws java.io.IOExceptionWrite an array of bytes to the buffered stream.- Parameters:
b- the array of bytes.offset- the offset into the array of bytes.length- the length of bytes.- Throws:
java.io.IOException
-
ensureSize
private void ensureSize(int length)
-
resize
private void resize(int length)
-
_flush
private void _flush() throws java.io.IOException- Throws:
java.io.IOException
-
encodeUTF8String
protected final int encodeUTF8String(java.lang.String s) throws java.io.IOExceptionEncode a string using the UTF-8 encoding.- Parameters:
s- the string to encode.- Throws:
java.io.IOException
-
ensureEncodingBufferSizeForUtf8String
private void ensureEncodingBufferSizeForUtf8String(int length)
-
encodeUTF8String
protected final int encodeUTF8String(char[] ch, int offset, int length) throws java.io.IOExceptionEncode a string using the UTF-8 encoding.- Parameters:
ch- the array of characters.offset- the offset into the array of characters.length- the length of characters.- Throws:
java.io.IOException
-
encodeCharacterAsUtf8FourByte
private void encodeCharacterAsUtf8FourByte(int c, char[] ch, int chpos, int chend, int bpos) throws java.io.IOException- Throws:
java.io.IOException
-
encodeUtf16String
protected final int encodeUtf16String(java.lang.String s) throws java.io.IOExceptionEncode a string using the UTF-16 encoding.- Parameters:
s- the string to encode.- Throws:
java.io.IOException
-
ensureEncodingBufferSizeForUtf16String
private void ensureEncodingBufferSizeForUtf16String(int length)
-
encodeUtf16String
protected final int encodeUtf16String(char[] ch, int offset, int length) throws java.io.IOExceptionEncode a string using the UTF-16 encoding.- Parameters:
ch- the array of characters.offset- the offset into the array of characters.length- the length of characters.- Throws:
java.io.IOException
-
getPrefixFromQualifiedName
public static java.lang.String getPrefixFromQualifiedName(java.lang.String qName)
Obtain the prefix from a qualified name.- Parameters:
qName- the qualified name- Returns:
- the prefix, or "" if there is no prefix.
-
isWhiteSpace
public static boolean isWhiteSpace(char[] ch, int start, int length)Check if character array contains characters that are all white space.- Parameters:
ch- the character arraystart- the starting character index into the array to check fromlength- the number of characters to check- Returns:
- true if all characters are white space, false otherwise
-
isWhiteSpace
public static boolean isWhiteSpace(java.lang.String s)
Check if a String contains characters that are all white space.- Parameters:
s- the string- Returns:
- true if all characters are white space, false otherwise
-
-