APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.util.xml

public Class PropertiesDefaultHandler

extends DefaultHandler
Class Inheritance
Imports
java.io.*, java.nio.charset.Charset, java.util.InvalidPropertiesFormatException, .Map.Entry, .Properties, jdk.internal.org.xml.sax.Attributes, .InputSource, .SAXException, .SAXParseException, jdk.internal.org.xml.sax.helpers.DefaultHandler, jdk.internal.util.xml.impl.SAXParserImpl, .XMLStreamWriterImpl

A class used to aid in Properties load and save in XML. This class is re-implemented using a subset of SAX
Author
Joe Wang
Since
1.8

Field Summary

Modifier and TypeField and Description
pack-priv static final String
pack-priv static final String
private static final String
pack-priv StringBuilder
private static final String
private static final String
private static final String
private static final String
EXTERNAL_XML_VERSION

Version number for the format of exported properties files.

pack-priv String
private Properties
private static final String
private static final String
private static final String
pack-priv String
pack-priv boolean
pack-priv boolean
pack-priv boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
characters(char[] ch, int start, int length)

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.characters.

Implements jdk.internal.org.xml.sax.ContentHandler.characters.

Receive notification of character data inside an element.

public void
endElement(String uri, String localName, String qName)

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.endElement.

Implements jdk.internal.org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

public void
error(SAXParseException x)

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.error.

Implements jdk.internal.org.xml.sax.ErrorHandler.error.

Receive notification of a recoverable parser error.

public void
public void
public InputSource
public void
startDTD(String name, String publicId, String systemId)

Overrides default jdk.internal.org.xml.sax.DTDHandler.startDTD.

Receive notification of the start of DTD declarations.

public void
startElement(String uri, String localName, String qName, Attributes attributes)

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.startElement.

Implements jdk.internal.org.xml.sax.ContentHandler.startElement.

Receive notification of the start of an element.

public void
startInternalSub()

Overrides default jdk.internal.org.xml.sax.DTDHandler.startInternalSub.

Receive notification of the start of DTD internal subset.

public void
store(Properties props, OutputStream os, String comment, Charset charset)

public void
Inherited from jdk.internal.org.xml.sax.helpers.DefaultHandler:
endDocumentendPrefixMappingignorableWhitespacenotationDeclprocessingInstructionsetDocumentLocatorskippedEntitystartDocumentstartPrefixMappingunparsedEntityDecl

Field Detail

ALLOWED_COMMENTback to summary
pack-priv static final String ALLOWED_COMMENT
ALLOWED_ELEMENTSback to summary
pack-priv static final String ALLOWED_ELEMENTS
ATTR_KEYback to summary
private static final String ATTR_KEY
bufback to summary
pack-priv StringBuilder buf
ELEMENT_COMMENTback to summary
private static final String ELEMENT_COMMENT
ELEMENT_ENTRYback to summary
private static final String ELEMENT_ENTRY
ELEMENT_ROOTback to summary
private static final String ELEMENT_ROOT
EXTERNAL_XML_VERSIONback to summary
private static final String EXTERNAL_XML_VERSION

Version number for the format of exported properties files.

keyback to summary
pack-priv String key
propertiesback to summary
private Properties properties
PROPS_DTDback to summary
private static final String PROPS_DTD
PROPS_DTD_DECLback to summary
private static final String PROPS_DTD_DECL
PROPS_DTD_URIback to summary
private static final String PROPS_DTD_URI
rootElmback to summary
pack-priv String rootElm
sawCommentback to summary
pack-priv boolean sawComment
sawRootback to summary
pack-priv boolean sawRoot
validEntryback to summary
pack-priv boolean validEntry

Constructor Detail

PropertiesDefaultHandlerback to summary
public PropertiesDefaultHandler()

Method Detail

charactersback to summary
public void characters(char[] ch, int start, int length) throws SAXException

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.characters.

Implements jdk.internal.org.xml.sax.ContentHandler.characters.

Doc from jdk.internal.org.xml.sax.helpers.DefaultHandler.characters.

Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
endElementback to summary
public void endElement(String uri, String localName, String qName) throws SAXException

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.endElement.

Implements jdk.internal.org.xml.sax.ContentHandler.endElement.

Doc from jdk.internal.org.xml.sax.helpers.DefaultHandler.endElement.

Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
errorback to summary
public void error(SAXParseException x) throws SAXException

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.error.

Implements jdk.internal.org.xml.sax.ErrorHandler.error.

Doc from jdk.internal.org.xml.sax.helpers.DefaultHandler.error.

Receive notification of a recoverable parser error.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each error, such as inserting the message in a log file or printing it to the console.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
fatalErrorback to summary
public void fatalError(SAXParseException x) throws SAXException

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.fatalError.

Implements jdk.internal.org.xml.sax.ErrorHandler.fatalError.

Doc from jdk.internal.org.xml.sax.helpers.DefaultHandler.fatalError.

Report a fatal XML parsing error.

The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
loadback to summary
public void load(Properties props, InputStream in) throws IOException, InvalidPropertiesFormatException, UnsupportedEncodingException
resolveEntityback to summary
public InputSource resolveEntity(String pubid, String sysid) throws SAXException, IOException

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.resolveEntity.

Implements jdk.internal.org.xml.sax.EntityResolver.resolveEntity.

Doc from jdk.internal.org.xml.sax.helpers.DefaultHandler.resolveEntity.

Resolve an external entity.

Always return null, so that the parser will use the system identifier provided in the XML document. This method implements the SAX default behaviour: application writers can override it in a subclass to do special translations such as catalog lookups or URI redirection.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
IOException:
If there is an error setting up the new input source.
startDTDback to summary
public void startDTD(String name, String publicId, String systemId) throws SAXException

Overrides default jdk.internal.org.xml.sax.DTDHandler.startDTD.

Doc from jdk.internal.org.xml.sax.DTDHandler.startDTD.

Receive notification of the start of DTD declarations. The start/endDTD events appear within the start/endDocument events from ContentHandler.

Annotations
@Override
Exceptions
SAXException:
the event receiver may throw an exception during processing
startElementback to summary
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.startElement.

Implements jdk.internal.org.xml.sax.ContentHandler.startElement.

Doc from jdk.internal.org.xml.sax.helpers.DefaultHandler.startElement.

Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
startInternalSubback to summary
public void startInternalSub() throws SAXException

Overrides default jdk.internal.org.xml.sax.DTDHandler.startInternalSub.

Doc from jdk.internal.org.xml.sax.DTDHandler.startInternalSub.

Receive notification of the start of DTD internal subset.

Annotations
@Override
Exceptions
SAXException:
the event receiver may throw an exception during processing
storeback to summary
public void store(Properties props, OutputStream os, String comment, Charset charset) throws IOException
warningback to summary
public void warning(SAXParseException x) throws SAXException

Overrides jdk.internal.org.xml.sax.helpers.DefaultHandler.warning.

Implements jdk.internal.org.xml.sax.ErrorHandler.warning.

Doc from jdk.internal.org.xml.sax.helpers.DefaultHandler.warning.

Receive notification of a parser warning.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each warning, such as inserting the message in a log file or printing it to the console.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.