APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.xml.internal.stream.writers

public Class WriterUtility

extends Object
Class Inheritance
Imports
java.io.FileWriter, .IOException, .OutputStreamWriter, .Writer, java.nio.charset.Charset, .CharsetEncoder, jdk.xml.internal.SecuritySupport

Implements common xml writer functions.
Author
Neeraj Bajaj,K.Venugopal Sun Microsystems.

Field Summary

Modifier and TypeField and Description
public static final String
public static final char
public static final char
pack-priv static final boolean
public static final String
public static final String
public static final String
public static final String
public static final String
pack-priv CharsetEncoder
pack-priv boolean
fEscapeCharacters

XXX: This feature is only used when writing element content values.

pack-priv Writer
fWriter

Writer object

public static final String
public static final char
public static final String
public static final String
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
public
public
WriterUtility(Writer writer)

Creates a new instance of WriterUtility

Method Summary

Modifier and TypeMethod and Description
private CharsetEncoder
public boolean
public void
setEscapeCharacters(boolean escape)

public void
setWriter(Writer
file to write into
writer
)

sets the writer object

public void
writeXMLAttributeValue(String value)

Write Attribute value to the underlying stream.

public void
writeXMLContent(char[] content, int start, int length)

writes xml content (characters and element content

private void
writeXMLContent(char[] content, int start, int length, boolean escapeCharacter)

writes xml content (characters and element content

public void
writeXMLContent(String content)

writes xml content (characters and element content

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLOSE_EMPTY_ELEMENTback to summary
public static final String CLOSE_EMPTY_ELEMENT
CLOSE_END_TAGback to summary
public static final char CLOSE_END_TAG
CLOSE_START_TAGback to summary
public static final char CLOSE_START_TAG
DEBUG_XML_CONTENTback to summary
pack-priv static final boolean DEBUG_XML_CONTENT
DEFAULT_ENCODINGback to summary
public static final String DEFAULT_ENCODING
DEFAULT_XML_VERSIONback to summary
public static final String DEFAULT_XML_VERSION
DEFAULT_XMLDECLback to summary
public static final String DEFAULT_XMLDECL
END_CDATAback to summary
public static final String END_CDATA
END_COMMENTback to summary
public static final String END_COMMENT
fEncoderback to summary
pack-priv CharsetEncoder fEncoder
fEscapeCharactersback to summary
pack-priv boolean fEscapeCharacters

XXX: This feature is only used when writing element content values. default value is 'true' however, if the feature is set to false characters won't be escaped. This feature has no effect when writing Attribute values, character would still be escaped. I can't think of any reason why this would be useful when writing attribute values. However, this can be reconsidered if there is any usecase.

fWriterback to summary
pack-priv Writer fWriter

Writer object

OPEN_END_TAGback to summary
public static final String OPEN_END_TAG
OPEN_START_TAGback to summary
public static final char OPEN_START_TAG
SPACEback to summary
public static final String SPACE
START_CDATAback to summary
public static final String START_CDATA
START_COMMENTback to summary
public static final String START_COMMENT
UTF_8back to summary
public static final String UTF_8

Constructor Detail

WriterUtilityback to summary
public WriterUtility()
WriterUtilityback to summary
public WriterUtility(Writer writer)

Creates a new instance of WriterUtility

Method Detail

getDefaultEncoderback to summary
private CharsetEncoder getDefaultEncoder()
getEscapeCharactersback to summary
public boolean getEscapeCharacters()
setEscapeCharactersback to summary
public void setEscapeCharacters(boolean escape)
setWriterback to summary
public void setWriter(Writer writer)

sets the writer object

Parameters
writer:Writer

file to write into

writeXMLAttributeValueback to summary
public void writeXMLAttributeValue(String value) throws IOException

Write Attribute value to the underlying stream.

writeXMLContentback to summary
public void writeXMLContent(char[] content, int start, int length) throws IOException

writes xml content (characters and element content

writeXMLContentback to summary
private void writeXMLContent(char[] content, int start, int length, boolean escapeCharacter) throws IOException

writes xml content (characters and element content

writeXMLContentback to summary
public void writeXMLContent(String content) throws IOException

writes xml content (characters and element content