# StreamResult

public class **StreamResult** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Result](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Result.html) <br />

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

<br />

### Constant Summary

|---|---|---|
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [FEATURE](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#FEATURE) | If `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerFactory.html#getFeature(java.lang.String)` returns true when passed this value as an argument, the Transformer supports Result output of this type. |

### Inherited Constant Summary

From interface [javax.xml.transform.Result](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Result.html)

|---|---|---|
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [PI_DISABLE_OUTPUT_ESCAPING](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Result.html#PI_DISABLE_OUTPUT_ESCAPING) | The name of the processing instruction that is sent if the result tree disables output escaping. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [PI_ENABLE_OUTPUT_ESCAPING](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Result.html#PI_ENABLE_OUTPUT_ESCAPING) | The name of the processing instruction that is sent if the result tree enables output escaping at some point after having received a PI_DISABLE_OUTPUT_ESCAPING processing instruction. |

### Public Constructor Summary

|---|---|
|   | [StreamResult](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#StreamResult())() Zero-argument default constructor. |
|   | [StreamResult](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#StreamResult(java.io.OutputStream))([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) outputStream) Construct a StreamResult from a byte stream. |
|   | [StreamResult](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#StreamResult(java.io.Writer))([Writer](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Writer.html) writer) Construct a StreamResult from a character stream. |
|   | [StreamResult](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#StreamResult(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) systemId) Construct a StreamResult from a URL. |
|   | [StreamResult](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#StreamResult(java.io.File))([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) f) Construct a StreamResult from a File. |

### Public Method Summary

|---|---|
| [OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) | [getOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#getOutputStream())() Get the byte stream that was set with setOutputStream. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getSystemId](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#getSystemId())() Get the system identifier that was set with setSystemId. |
| [Writer](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Writer.html) | [getWriter](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#getWriter())() Get the character stream that was set with setWriter. |
| void | [setOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#setOutputStream(java.io.OutputStream))([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) outputStream) Set the ByteStream that is to be written to. |
| void | [setSystemId](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#setSystemId(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) 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 | [setSystemId](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#setSystemId(java.io.File))([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) f) Set the system ID from a `File` reference. |
| void | [setWriter](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/stream/StreamResult.html#setWriter(java.io.Writer))([Writer](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Writer.html) writer) Set the writer that is to receive the result. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [javax.xml.transform.Result](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Result.html)

|---|---|
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getSystemId](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Result.html#getSystemId())() Get the system identifier that was set with setSystemId. |
| abstract void | [setSystemId](https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/Result.html#setSystemId(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) systemId) Set the system identifier for this Result. |

## Constants

#### public static final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**FEATURE**

If `https://developers.google.com/j2objc/javadoc/jre/reference/javax/xml/transform/TransformerFactory.html#getFeature(java.lang.String)`
returns true when passed this value as an argument,
the Transformer supports Result output of this type.
Constant Value: "http://javax.xml.transform.stream.StreamResult/feature"

## Public Constructors

#### public
**StreamResult**
()

Zero-argument default constructor.

#### public
**StreamResult**
([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) 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. |
|---|---|

#### public
**StreamResult**
([Writer](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Writer.html) 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. |
|---|---|

#### public
**StreamResult**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) systemId)

Construct a StreamResult from a URL.

##### Parameters

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

#### public
**StreamResult**
([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) f)

Construct a StreamResult from a File.

##### Parameters

| f | Must a non-null File reference. |
|---|---|

## Public Methods

#### public [OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html)
**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.

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**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.

#### public [Writer](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Writer.html)
**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.

#### public void
**setOutputStream**
([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) 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. |
|---|---|

#### public void
**setSystemId**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) 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. |
|---|---|

#### public void
**setSystemId**
([File](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html) f)

<br />

Set the system ID from a `File` reference.

Note the use of `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html#toURI()` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html#toURL()`.
`toURI()` is preferred and used if possible.
To allow JAXP 1.3 to run on J2SE 1.3, `toURL()`
is used if a `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NoSuchMethodException.html` is thrown by the attempt
to use `toURI()`.

<br />

##### Parameters

| f | Must a non-null File reference. |
|---|---|

#### public void
**setWriter**
([Writer](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Writer.html) 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. |
|---|---|