This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.xml.transform.stream
class StreamResult

java.lang.Object extended by javax.xml.transform.stream.StreamResult
All Implemented Interfaces:
Result

Most common ways to construct:

StringWriter sw = …;

StreamResult result = new StreamResult(sw);

Based on 27 examples

 

ByteArrayOutputStream bos = …;

StreamResult sr = new StreamResult(bos);

Based on 19 examples


public class StreamResult
extends Object
implements Result

Acts as an holder for a transformation result, which may be XML, plain Text, HTML, or some other form of markup.


Field Summary
static String FEATURE
          If javax.xml.transform.TransformerFactory.getFeature returns true when passed this value as an argument, the Transformer supports Result output of this type.
 
Constructor Summary

          Zero-argument default constructor.

          Construct a StreamResult from a File.
StreamResult(OutputStream outputStream)

          Construct a StreamResult from a byte stream.
StreamResult(String systemId)

          Construct a StreamResult from a URL.

          Construct a StreamResult from a character stream.
 
Method Summary
 OutputStream

          Get the byte stream that was set with setOutputStream.
 String

          Get the system identifier that was set with setSystemId.
 Writer

          Get the character stream that was set with setWriter.
 void

          Set the ByteStream that is to be written to.
 void

          Set the system ID from a File reference.
 void
setSystemId(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).
 void
setWriter(Writer writer)

          Set the writer that is to receive the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEATURE

public static final String FEATURE
If {@link javax.xml.transform.TransformerFactory#getFeature} returns true when passed this value as an argument, the Transformer supports Result output of this type.
Constructor Detail

StreamResult

public StreamResult()
Zero-argument default constructor.


StreamResult

public StreamResult(File f)
Construct a StreamResult from a File.

Parameters:
f - Must a non-null File reference.

StreamResult

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.

Parameters:
outputStream - A valid OutputStream reference.

StreamResult

public StreamResult(String systemId)
Construct a StreamResult from a URL.

Parameters:
systemId - Must be a String that conforms to the URI syntax.

StreamResult

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.

Parameters:
writer - A valid Writer reference.
Method Detail

getOutputStream

public OutputStream getOutputStream()
Get the byte stream that was set with setOutputStream.

Returns:
The byte stream that was set with setOutputStream, or null if setOutputStream or the ByteStream constructor was not called.

getSystemId

public String getSystemId()
Get the system identifier that was set with setSystemId.

Returns:
The system identifier that was set with setSystemId, or null if setSystemId was not called.

getWriter

public Writer getWriter()
Get the character stream that was set with setWriter.

Returns:
The character stream that was set with setWriter, or null if setWriter or the Writer constructor was not called.

setOutputStream

public void setOutputStream(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.

Parameters:
outputStream - A valid OutputStream reference.

setSystemId

public void setSystemId(File f)

Set the system ID from a File reference.

Parameters:
f - Must a non-null File reference.

setSystemId

public void setSystemId(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).

Parameters:
systemId - The system identifier as a URI string.

setWriter

public void setWriter(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.

Parameters:
writer - A valid Writer reference.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.