FastInfosetSerializer, EncodingAlgorithmContentHandler, ExtendedContentHandler, FastInfosetWriter, PrimitiveTypeContentHandler, RestrictedAlphabetContentHandler, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandlerSAXDocumentSerializerWithPrefixMappingpublic class SAXDocumentSerializer extends Encoder implements FastInfosetWriter
Instantiate this serializer to serialize a fast infoset document in accordance with the SAX API.
This utilizes the SAX API in a reverse manner to that of parsing. It is the responsibility of the client to call the appropriate event methods on the SAX handlers, and to ensure that such a sequence of methods calls results in the production well-formed fast infoset documents. The SAXDocumentSerializer performs no well-formed checks.
More than one fast infoset document may be encoded to the
OutputStream.
| Modifier and Type | Field | Description |
|---|---|---|
protected boolean |
_charactersAsCDATA |
|
protected boolean |
_elementHasNamespaces |
_b, _characterEncodingSchemeSystemDefault, _charBuffer, _markIndex, _octetBuffer, _octetBufferIndex, _s, _terminate, _v, _vData, attributeValueMapTotalCharactersConstraint, CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY, characterContentChunkMapTotalCharactersConstraint, maxAttributeValueSize, maxCharacterContentChunkSize, minAttributeValueSize, minCharacterContentChunkSizeATTRIBUTE_VALUE_MAP_MEMORY_CONSTRAINT, BUFFER_SIZE_PROPERTY, CHARACTER_CONTENT_CHUNK_MAP_MEMORY_CONSTRAINT, EXTERNAL_VOCABULARIES_PROPERTY, IGNORE_COMMENTS_FEATURE, IGNORE_DTD_FEATURE, IGNORE_PROCESSING_INSTRUCTIONS_FEATURE, IGNORE_WHITE_SPACE_TEXT_CONTENT_FEATURE, MAX_ATTRIBUTE_VALUE_SIZE, MAX_CHARACTER_CONTENT_CHUNK_SIZE, MIN_ATTRIBUTE_VALUE_SIZE, MIN_CHARACTER_CONTENT_CHUNK_SIZE, REGISTERED_ENCODING_ALGORITHMS_PROPERTY, UTF_16BE, UTF_8| Modifier | Constructor | Description |
|---|---|---|
|
SAXDocumentSerializer() |
|
protected |
SAXDocumentSerializer(boolean v) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
alphabetCharacters(java.lang.String alphabet,
char[] ch,
int start,
int length) |
|
void |
booleans(boolean[] b,
int start,
int length) |
Receive notification of character data as an array of boolean.
|
void |
bytes(byte[] b,
int start,
int length) |
Receive notification of character data as an array of byte.
|
void |
characters(char[] ch,
int start,
int length) |
|
void |
characters(char[] ch,
int start,
int length,
boolean index) |
Receive notification of character data.
|
void |
comment(char[] ch,
int start,
int length) |
|
protected int |
countAttributes(org.xml.sax.Attributes atts) |
|
void |
dateTimeCharacters(char[] ch,
int start,
int length) |
|
void |
doubles(double[] d,
int start,
int length) |
Receive notification of character data as an array of double.
|
protected boolean |
encodeAttribute(java.lang.String namespaceURI,
java.lang.String qName,
java.lang.String localName) |
|
protected void |
encodeAttributes(org.xml.sax.Attributes atts) |
|
protected void |
encodeElement(java.lang.String namespaceURI,
java.lang.String qName,
java.lang.String localName) |
|
void |
endCDATA() |
|
void |
endDocument() |
|
void |
endDTD() |
|
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName) |
|
void |
endEntity(java.lang.String name) |
|
void |
floats(float[] f,
int start,
int length) |
Receive notification of character data as an array of float.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
|
void |
ints(int[] i,
int start,
int length) |
Receive notification of character data as an array of int.
|
void |
longs(long[] l,
int start,
int length) |
Receive notification of character data as an array of long.
|
void |
numericCharacters(char[] ch,
int start,
int length) |
|
void |
object(java.lang.String URI,
int id,
java.lang.Object data) |
Receive notification of encoding algorithm data as an object.
|
void |
octets(java.lang.String URI,
int id,
byte[] b,
int start,
int length) |
Receive notification of encoding algorithm data as an array
of byte.
|
void |
processingInstruction(java.lang.String target,
java.lang.String data) |
|
void |
reset() |
Reset the encoder for reuse encoding another XML infoset.
|
void |
setDocumentLocator(org.xml.sax.Locator locator) |
|
void |
shorts(short[] s,
int start,
int length) |
Receive notification of character data as an array of short.
|
void |
skippedEntity(java.lang.String name) |
|
void |
startCDATA() |
|
void |
startDocument() |
|
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId) |
|
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts) |
|
void |
startEntity(java.lang.String name) |
|
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri) |
|
void |
uuids(long[] msblsb,
int start,
int length) |
Receive notification of character data as an two array of UUID.
|
endPrefixMapping, error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warningcanAddAttributeToTable, canAddCharacterContentToTable, encodeAIIBuiltInAlgorithmData, encodeAIIObjectAlgorithmData, encodeAIIOctetAlgorithmData, encodeAlphabetCharacters, encodeAttributeQualifiedNameOnSecondBit, encodeCharacters, encodeCharactersNoClone, encodeCIIBuiltInAlgorithmData, encodeCIIBuiltInAlgorithmDataAsCDATA, encodeCIIObjectAlgorithmData, encodeCIIOctetAlgorithmData, encodeComment, encodeCommentNoClone, encodeDateTimeFourBitCharacters, encodeDateTimeNonIdentifyingStringOnFirstBit, encodeDocumentTermination, encodeDocumentTypeDeclaration, encodeElementQualifiedNameOnThirdBit, encodeElementTermination, encodeFourBitCharacters, encodeHeader, encodeIdentifyingNonEmptyStringOnFirstBit, encodeInitialVocabulary, encodeLiteralAttributeQualifiedNameOnSecondBit, encodeLiteralElementQualifiedNameOnThirdBit, encodeNamespaceAttribute, encodeNonEmptyCharacterStringOnFifthBit, encodeNonEmptyCharacterStringOnFifthBit, encodeNonEmptyCharacterStringOnSeventhBit, encodeNonEmptyFourBitCharacterString, encodeNonEmptyFourBitCharacterStringOnSeventhBit, encodeNonEmptyNBitCharacterStringOnSeventhBit, encodeNonEmptyOctetStringOnSecondBit, encodeNonEmptyUTF8StringAsOctetString, encodeNonEmptyUTF8StringAsOctetString, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnThirdBit, encodeNonIdentifyingStringOnThirdBit, encodeNonIdentifyingStringOnThirdBit, encodeNonZeroInteger, encodeNonZeroIntegerOnFourthBit, encodeNonZeroIntegerOnSecondBitFirstBitOne, encodeNonZeroIntegerOnSecondBitFirstBitZero, encodeNonZeroIntegerOnThirdBit, encodeNonZeroOctetStringLength, encodeNonZeroOctetStringLengthOnFifthBit, encodeNonZeroOctetStringLengthOnSecondBit, encodeNonZeroOctetStringLengthOnSenventhBit, encodeNumericFourBitCharacters, encodeNumericNonIdentifyingStringOnFirstBit, encodeProcessingInstruction, encodeTermination, encodeUtf16String, encodeUtf16String, encodeUTF8String, encodeUTF8String, getAttributeValueMapMemoryLimit, getCharacterContentChunkMapMemoryLimit, getCharacterEncodingScheme, getIgnoreComments, getIgnoreDTD, getIgnoreProcesingInstructions, getIgnoreWhiteSpaceTextContent, getMaxAttributeValueSize, getMaxCharacterContentChunkSize, getMinAttributeValueSize, getMinCharacterContentChunkSize, getPrefixFromQualifiedName, getRegisteredEncodingAlgorithms, getVocabularyApplicationData, hasMark, isAttributeValueLengthMatchesLimit, isCharacterContentChunkLengthMatchesLimit, isWhiteSpace, isWhiteSpace, mark, resetMark, setAttributeValueMapMemoryLimit, setCharacterContentChunkMapMemoryLimit, setCharacterEncodingScheme, setExternalVocabulary, setIgnoreComments, setIgnoreDTD, setIgnoreProcesingInstructions, setIgnoreWhiteSpaceTextContent, setMaxAttributeValueSize, setMaxCharacterContentChunkSize, setMinAttributeValueSize, setMinCharacterContentChunkSize, setOutputStream, setRegisteredEncodingAlgorithms, setVocabulary, setVocabularyApplicationData, write, write, writegetAttributeValueMapMemoryLimit, getCharacterContentChunkMapMemoryLimit, getCharacterEncodingScheme, getIgnoreComments, getIgnoreDTD, getIgnoreProcesingInstructions, getIgnoreWhiteSpaceTextContent, getMaxAttributeValueSize, getMaxCharacterContentChunkSize, getMinAttributeValueSize, getMinCharacterContentChunkSize, getRegisteredEncodingAlgorithms, getVocabularyApplicationData, setAttributeValueMapMemoryLimit, setCharacterContentChunkMapMemoryLimit, setCharacterEncodingScheme, setExternalVocabulary, setIgnoreComments, setIgnoreDTD, setIgnoreProcesingInstructions, setIgnoreWhiteSpaceTextContent, setMaxAttributeValueSize, setMaxCharacterContentChunkSize, setMinAttributeValueSize, setMinCharacterContentChunkSize, setOutputStream, setRegisteredEncodingAlgorithms, setVocabularyApplicationDataprotected boolean _elementHasNamespaces
protected boolean _charactersAsCDATA
protected SAXDocumentSerializer(boolean v)
public SAXDocumentSerializer()
public void reset()
Encoderreset in interface FastInfosetSerializerreset in class Encoderpublic final void startDocument()
throws org.xml.sax.SAXException
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic final void endDocument()
throws org.xml.sax.SAXException
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
throws org.xml.sax.SAXException
startPrefixMapping in interface org.xml.sax.ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic final void startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic final void endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic final void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic final void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
ignorableWhitespace in interface org.xml.sax.ContentHandlerignorableWhitespace in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic final void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
processingInstruction in interface org.xml.sax.ContentHandlerprocessingInstruction in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic final void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator in interface org.xml.sax.ContentHandlersetDocumentLocator in class org.xml.sax.helpers.DefaultHandlerpublic final void skippedEntity(java.lang.String name)
throws org.xml.sax.SAXException
skippedEntity in interface org.xml.sax.ContentHandlerskippedEntity in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic final void comment(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
comment in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic final void startCDATA()
throws org.xml.sax.SAXException
startCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic final void endCDATA()
throws org.xml.sax.SAXException
endCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic final void startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
startDTD in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic final void endDTD()
throws org.xml.sax.SAXException
endDTD in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic final void startEntity(java.lang.String name)
throws org.xml.sax.SAXException
startEntity in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic final void endEntity(java.lang.String name)
throws org.xml.sax.SAXException
endEntity in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXExceptionpublic final void octets(java.lang.String URI,
int id,
byte[] b,
int start,
int length)
throws org.xml.sax.SAXException
EncodingAlgorithmContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing encoding algorithm data.
The Parser will call the method of this interface to report each encoding algorithm data. Parsers MUST return all contiguous characters in a single chunk
Parsers may return all contiguous bytes in a single chunk, or they may split it into several chunks providing that the length of each chunk is of the required length to successfully apply the encoding algorithm to the chunk.
octets in interface EncodingAlgorithmContentHandlerURI - the URI of the encoding algorithmid - the encoding algorithm indexb - the array of bytestart - the start position in the arraylength - the number of byte to read from the arrayorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionEncodingAlgorithmIndexespublic final void object(java.lang.String URI,
int id,
java.lang.Object data)
throws org.xml.sax.SAXException
EncodingAlgorithmContentHandlerSuch notifications will occur for a Fast Infoset SAX parser when processing encoding algorithm data that is converted from an array of byte to an object more suitable for processing.
object in interface EncodingAlgorithmContentHandlerURI - the URI of the encoding algorithmid - the encoding algorithm indexdata - the encoding algorithm objectorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionEncodingAlgorithmIndexespublic final void bytes(byte[] b,
int start,
int length)
throws org.xml.sax.SAXException
PrimitiveTypeContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing data encoded using the "base64" encoding algorithm, see subclause 10.3, or the "hexadecimal" encoding algorithm, see subclause 10.2.
Such a notification may occur for binary data that would
normally require base 64 encoding and reported as character data
using the characters
method
.
bytes in interface PrimitiveTypeContentHandlerb - the array of bytestart - the start position in the arraylength - the number of byte to read from the arrayorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionpublic final void shorts(short[] s,
int start,
int length)
throws org.xml.sax.SAXException
PrimitiveTypeContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing data encoded using the "short" encoding algorithm, see subclause 10.4
.
shorts in interface PrimitiveTypeContentHandlers - the array of shortstart - the start position in the arraylength - the number of short to read from the arrayorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionpublic final void ints(int[] i,
int start,
int length)
throws org.xml.sax.SAXException
PrimitiveTypeContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing data encoded using the "int" encoding algorithm, see subclause 10.5
.
ints in interface PrimitiveTypeContentHandleri - the array of intstart - the start position in the arraylength - the number of int to read from the arrayorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionpublic final void longs(long[] l,
int start,
int length)
throws org.xml.sax.SAXException
PrimitiveTypeContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing data encoded using the "long" encoding algorithm, see subclause 10.6
.
longs in interface PrimitiveTypeContentHandlerl - the array of longstart - the start position in the arraylength - the number of long to read from the arrayorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionpublic final void booleans(boolean[] b,
int start,
int length)
throws org.xml.sax.SAXException
PrimitiveTypeContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing data encoded using the "boolean" encoding algorithm, see subclause 10.7
.
booleans in interface PrimitiveTypeContentHandlerb - the array of booleanstart - the start position in the arraylength - the number of boolean to read from the arrayorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionpublic final void floats(float[] f,
int start,
int length)
throws org.xml.sax.SAXException
PrimitiveTypeContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing data encoded using the "float" encoding algorithm, see subclause 10.8
.
floats in interface PrimitiveTypeContentHandlerf - the array of floatstart - the start position in the arraylength - the number of float to read from the arrayorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionpublic final void doubles(double[] d,
int start,
int length)
throws org.xml.sax.SAXException
PrimitiveTypeContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing data encoded using the "double" encoding algorithm, see subclause 10.9
.
doubles in interface PrimitiveTypeContentHandlerd - the array of doublestart - the start position in the arraylength - the number of double to read from the arrayorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionpublic void uuids(long[] msblsb,
int start,
int length)
throws org.xml.sax.SAXException
PrimitiveTypeContentHandlerThe application must not attempt to read from the array outside of the specified range.
Such notifications will occur for a Fast Infoset SAX parser when processing data encoded using the "uuid" encoding algorithm, see subclause 10.10
.
uuids in interface PrimitiveTypeContentHandlermsblsb - the array of long containing pairs of most signficant
bits and least significant bits of the UUIDsstart - the start position in the arraylength - the number of long to read from the array. This will
be twice the number of UUIDs, which are pairs of two long valuesorg.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionpublic void numericCharacters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
numericCharacters in interface RestrictedAlphabetContentHandlerorg.xml.sax.SAXExceptionpublic void dateTimeCharacters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
dateTimeCharacters in interface RestrictedAlphabetContentHandlerorg.xml.sax.SAXExceptionpublic void alphabetCharacters(java.lang.String alphabet,
char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
alphabetCharacters in interface RestrictedAlphabetContentHandlerorg.xml.sax.SAXExceptionpublic void characters(char[] ch,
int start,
int length,
boolean index)
throws org.xml.sax.SAXException
ExtendedContentHandlercharacters in interface ExtendedContentHandlerch - the characters from the XML documentstart - the start position in the arraylength - the number of characters to read from the arrayindex - true if the characters are indexed, otherwise false.org.xml.sax.SAXException - any SAX exception, possibly
wrapping another exceptionContentHandler.characters(char[], int, int)protected final int countAttributes(org.xml.sax.Attributes atts)
protected void encodeAttributes(org.xml.sax.Attributes atts)
throws java.io.IOException,
FastInfosetException
java.io.IOExceptionFastInfosetExceptionprotected void encodeElement(java.lang.String namespaceURI,
java.lang.String qName,
java.lang.String localName)
throws java.io.IOException
java.io.IOExceptionprotected boolean encodeAttribute(java.lang.String namespaceURI,
java.lang.String qName,
java.lang.String localName)
throws java.io.IOException
java.io.IOExceptionCopyright © 2018 Oracle Corporation. All rights reserved.