StreamResultpublic class StreamResult extends Object implements ResultActs as an holder for a transformation result,
which may be XML, plain Text, HTML, or some other form of markup. |
Fields Summary |
---|
public static final String | FEATUREIf {@link javax.xml.transform.TransformerFactory#getFeature}
returns true when passed this value as an argument,
the Transformer supports Result output of this type. | private String | systemIdThe systemID that may be used in association
with the byte or character stream, or, if neither is set, use
this value as a writeable URI (probably a file name). | private OutputStream | outputStreamThe byte stream that is to be written to. | private Writer | writerThe character stream that is to be written to. |
Constructors Summary |
---|
public StreamResult()Zero-argument default constructor.
| public StreamResult(OutputStream outputStream)Construct a StreamResult from a byte stream. Normally,
a stream should be used rather than a reader, so that
the transformer may use instructions contained in the
transformation instructions to control the encoding.
setOutputStream(outputStream);
| public StreamResult(Writer writer)Construct a StreamResult from a character stream. Normally,
a stream should be used rather than a reader, so that
the transformer may use instructions contained in the
transformation instructions to control the encoding. However,
there are times when it is useful to write to a character
stream, such as when using a StringWriter.
setWriter(writer);
| public StreamResult(String systemId)Construct a StreamResult from a URL.
this.systemId = systemId;
| public StreamResult(File f)Construct a StreamResult from a File.
//convert file to appropriate URI, f.toURI().toASCIIString()
//converts the URI to string as per rule specified in
//RFC 2396,
setSystemId(f.toURI().toASCIIString());
|
Methods Summary |
---|
public java.io.OutputStream | getOutputStream()Get the byte stream that was set with setOutputStream.
return outputStream;
| public java.lang.String | getSystemId()Get the system identifier that was set with setSystemId.
return systemId;
| public java.io.Writer | getWriter()Get the character stream that was set with setWriter.
return writer;
| public void | setOutputStream(java.io.OutputStream outputStream)Set the ByteStream that is to be written to. Normally,
a stream should be used rather than a reader, so that
the transformer may use instructions contained in the
transformation instructions to control the encoding.
this.outputStream = outputStream;
| public void | setSystemId(java.lang.String systemId)Set the systemID that may be used in association
with the byte or character stream, or, if neither is set, use
this value as a writeable URI (probably a file name).
this.systemId = systemId;
| public void | setSystemId(java.io.File f)Set the system ID from a File reference.
//convert file to appropriate URI, f.toURI().toASCIIString()
//converts the URI to string as per rule specified in
//RFC 2396,
this.systemId = f.toURI().toASCIIString();
| public void | setWriter(java.io.Writer writer)Set the writer that is to receive the result. Normally,
a stream should be used rather than a writer, so that
the transformer may use instructions contained in the
transformation instructions to control the encoding. However,
there are times when it is useful to write to a writer,
such as when using a StringWriter.
this.writer = writer;
|
|