LSOutput
Stay organized with collections
Save and categorize content based on your preferences.
This interface represents an output destination for data.
This interface allows an application to encapsulate information about
an output destination in a single object, which may include a URI, a byte
stream (possibly with a specified encoding), a base URI, and/or a
character stream.
The exact definitions of a byte stream and a character stream are
binding dependent.
The application is expected to provide objects that implement this
interface whenever such objects are needed. The application can either
provide its own objects that implement this interface, or it can use the
generic factory method DOMImplementationLS.createLSOutput()
to create objects that implement this interface.
The LSSerializer
will use the LSOutput
object
to determine where to serialize the output to. The
LSSerializer
will look at the different outputs specified in
the LSOutput
in the following order to know which one to
output to, the first one that is not null and not an empty string will be
used:
-
LSOutput.characterStream
-
LSOutput.byteStream
-
LSOutput.systemId
LSOutput
objects belong to the application. The DOM
implementation will never modify them (though it may make copies and
modify the copies, if necessary).
See also the Document Object Model (DOM) Level 3 Load
and Save Specification.
Public Method Summary
abstract
OutputStream
|
getByteStream()
An attribute of a language and binding dependent type that represents
a writable stream of bytes.
|
abstract
Writer
|
getCharacterStream()
An attribute of a language and binding dependent type that represents
a writable stream to which 16-bit units can be output.
|
abstract
String
|
getEncoding()
The character encoding to use for the output.
|
abstract
String
|
|
abstract
void
|
setByteStream( OutputStream byteStream)
An attribute of a language and binding dependent type that represents
a writable stream of bytes.
|
abstract
void
|
setCharacterStream( Writer characterStream)
An attribute of a language and binding dependent type that represents
a writable stream to which 16-bit units can be output.
|
abstract
void
|
|
abstract
void
|
|
Public Methods
public
abstract
OutputStream
getByteStream
()
An attribute of a language and binding dependent type that represents
a writable stream of bytes.
public
abstract
Writer
getCharacterStream
()
An attribute of a language and binding dependent type that represents
a writable stream to which 16-bit units can be output.
public
abstract
String
getEncoding
()
The character encoding to use for the output. The encoding must be a
string acceptable for an XML encoding declaration ([XML 1.0] section
4.3.3 "Character Encoding in Entities"), it is recommended that
character encodings registered (as charsets) with the Internet
Assigned Numbers Authority [IANA-CHARSETS]
should be referred to using their registered names.
public
abstract
String
getSystemId
()
The system identifier, a URI reference [IETF RFC 2396], for this
output destination.
If the system ID is a relative URI reference (see section 5 in [IETF RFC 2396]), the
behavior is implementation dependent.
public
abstract
void
setByteStream
(OutputStream byteStream)
An attribute of a language and binding dependent type that represents
a writable stream of bytes.
public
abstract
void
setCharacterStream
(Writer characterStream)
An attribute of a language and binding dependent type that represents
a writable stream to which 16-bit units can be output.
public
abstract
void
setEncoding
(String encoding)
The character encoding to use for the output. The encoding must be a
string acceptable for an XML encoding declaration ([XML 1.0] section
4.3.3 "Character Encoding in Entities"), it is recommended that
character encodings registered (as charsets) with the Internet
Assigned Numbers Authority [IANA-CHARSETS]
should be referred to using their registered names.
public
abstract
void
setSystemId
(String systemId)
The system identifier, a URI reference [IETF RFC 2396], for this
output destination.
If the system ID is a relative URI reference (see section 5 in [IETF RFC 2396]), the
behavior is implementation dependent.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eLSOutput\u003c/code\u003e interface represents an output destination for serialized DOM data, encapsulating information like URI, byte stream, and character stream.\u003c/p\u003e\n"],["\u003cp\u003eApplications can provide their own \u003ccode\u003eLSOutput\u003c/code\u003e implementations or use the \u003ccode\u003eDOMImplementationLS.createLSOutput()\u003c/code\u003e factory method.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLSSerializer\u003c/code\u003e uses \u003ccode\u003eLSOutput\u003c/code\u003e to determine where to serialize, prioritizing \u003ccode\u003echaracterStream\u003c/code\u003e, then \u003ccode\u003ebyteStream\u003c/code\u003e, and finally \u003ccode\u003esystemId\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLSOutput\u003c/code\u003e objects are owned and managed by the application, with the DOM implementation only making copies if modifications are necessary.\u003c/p\u003e\n"]]],["The `LSOutput` interface defines an output destination for data, encapsulating information like URI, byte stream, character stream, and base URI. Applications provide `LSOutput` objects, or use `DOMImplementationLS.createLSOutput()`. `LSSerializer` uses these objects to determine output locations, prioritizing character stream, then byte stream, and finally system ID. `LSOutput` offers methods to set/get these attributes, including encoding, ensuring writable output streams for bytes and 16-bit units.\n"],null,["public interface **LSOutput** \nThis interface represents an output destination for data.\n\nThis interface allows an application to encapsulate information about\nan output destination in a single object, which may include a URI, a byte\nstream (possibly with a specified encoding), a base URI, and/or a\ncharacter stream.\n\nThe exact definitions of a byte stream and a character stream are\nbinding dependent.\n\nThe application is expected to provide objects that implement this\ninterface whenever such objects are needed. The application can either\nprovide its own objects that implement this interface, or it can use the\ngeneric factory method `DOMImplementationLS.createLSOutput()`\nto create objects that implement this interface.\n\nThe `LSSerializer` will use the `LSOutput` object\nto determine where to serialize the output to. The\n`LSSerializer` will look at the different outputs specified in\nthe `LSOutput` in the following order to know which one to\noutput to, the first one that is not null and not an empty string will be\nused:\n\n1. `LSOutput.characterStream`\n2. `LSOutput.byteStream`\n3. `LSOutput.systemId`\n\n`LSOutput` objects belong to the application. The DOM\nimplementation will never modify them (though it may make copies and\nmodify the copies, if necessary).\n\nSee also the [Document Object Model (DOM) Level 3 Load\nand Save Specification](http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407). \n\nPublic Method Summary\n\n|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [OutputStream](../../../../../reference/java/io/OutputStream.html) | [getByteStream](../../../../../reference/org/w3c/dom/ls/LSOutput.html#getByteStream())() An attribute of a language and binding dependent type that represents a writable stream of bytes. |\n| abstract [Writer](../../../../../reference/java/io/Writer.html) | [getCharacterStream](../../../../../reference/org/w3c/dom/ls/LSOutput.html#getCharacterStream())() An attribute of a language and binding dependent type that represents a writable stream to which 16-bit units can be output. |\n| abstract [String](../../../../../reference/java/lang/String.html) | [getEncoding](../../../../../reference/org/w3c/dom/ls/LSOutput.html#getEncoding())() The character encoding to use for the output. |\n| abstract [String](../../../../../reference/java/lang/String.html) | [getSystemId](../../../../../reference/org/w3c/dom/ls/LSOutput.html#getSystemId())() The system identifier, a URI reference \\[[IETF RFC 2396](http://www.ietf.org/rfc/rfc2396.txt)\\], for this output destination. |\n| abstract void | [setByteStream](../../../../../reference/org/w3c/dom/ls/LSOutput.html#setByteStream(java.io.OutputStream))([OutputStream](../../../../../reference/java/io/OutputStream.html) byteStream) An attribute of a language and binding dependent type that represents a writable stream of bytes. |\n| abstract void | [setCharacterStream](../../../../../reference/org/w3c/dom/ls/LSOutput.html#setCharacterStream(java.io.Writer))([Writer](../../../../../reference/java/io/Writer.html) characterStream) An attribute of a language and binding dependent type that represents a writable stream to which 16-bit units can be output. |\n| abstract void | [setEncoding](../../../../../reference/org/w3c/dom/ls/LSOutput.html#setEncoding(java.lang.String))([String](../../../../../reference/java/lang/String.html) encoding) The character encoding to use for the output. |\n| abstract void | [setSystemId](../../../../../reference/org/w3c/dom/ls/LSOutput.html#setSystemId(java.lang.String))([String](../../../../../reference/java/lang/String.html) systemId) The system identifier, a URI reference \\[[IETF RFC 2396](http://www.ietf.org/rfc/rfc2396.txt)\\], for this output destination. |\n\nPublic Methods \n\npublic abstract [OutputStream](../../../../../reference/java/io/OutputStream.html)\n**getByteStream**\n() \nAn attribute of a language and binding dependent type that represents\na writable stream of bytes. \n\npublic abstract [Writer](../../../../../reference/java/io/Writer.html)\n**getCharacterStream**\n() \nAn attribute of a language and binding dependent type that represents\na writable stream to which 16-bit units can be output. \n\npublic abstract [String](../../../../../reference/java/lang/String.html)\n**getEncoding**\n() \nThe character encoding to use for the output. The encoding must be a\nstring acceptable for an XML encoding declaration (\\[[XML 1.0](http://www.w3.org/TR/2004/REC-xml-20040204)\\] section\n4.3.3 \"Character Encoding in Entities\"), it is recommended that\ncharacter encodings registered (as charsets) with the Internet\nAssigned Numbers Authority \\[[IANA-CHARSETS](ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets)\\]\nshould be referred to using their registered names. \n\npublic abstract [String](../../../../../reference/java/lang/String.html)\n**getSystemId**\n() \nThe system identifier, a URI reference \\[[IETF RFC 2396](http://www.ietf.org/rfc/rfc2396.txt)\\], for this\noutput destination.\n\nIf the system ID is a relative URI reference (see section 5 in \\[[IETF RFC 2396](http://www.ietf.org/rfc/rfc2396.txt)\\]), the\nbehavior is implementation dependent. \n\npublic abstract void\n**setByteStream**\n([OutputStream](../../../../../reference/java/io/OutputStream.html) byteStream) \nAn attribute of a language and binding dependent type that represents\na writable stream of bytes. \n\nParameters\n\n| byteStream | |\n|------------|---|\n\npublic abstract void\n**setCharacterStream**\n([Writer](../../../../../reference/java/io/Writer.html) characterStream) \nAn attribute of a language and binding dependent type that represents\na writable stream to which 16-bit units can be output. \n\nParameters\n\n| characterStream | |\n|-----------------|---|\n\npublic abstract void\n**setEncoding**\n([String](../../../../../reference/java/lang/String.html) encoding) \nThe character encoding to use for the output. The encoding must be a\nstring acceptable for an XML encoding declaration (\\[[XML 1.0](http://www.w3.org/TR/2004/REC-xml-20040204)\\] section\n4.3.3 \"Character Encoding in Entities\"), it is recommended that\ncharacter encodings registered (as charsets) with the Internet\nAssigned Numbers Authority \\[[IANA-CHARSETS](ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets)\\]\nshould be referred to using their registered names. \n\nParameters\n\n| encoding | |\n|----------|---|\n\npublic abstract void\n**setSystemId**\n([String](../../../../../reference/java/lang/String.html) systemId) \nThe system identifier, a URI reference \\[[IETF RFC 2396](http://www.ietf.org/rfc/rfc2396.txt)\\], for this\noutput destination.\n\nIf the system ID is a relative URI reference (see section 5 in \\[[IETF RFC 2396](http://www.ietf.org/rfc/rfc2396.txt)\\]), the\nbehavior is implementation dependent. \n\nParameters\n\n| systemId | |\n|----------|---|"]]