Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#constants) \| [Ctors](https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#pubctors) \| [Methods](https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#inhmethods)

# StreamSource

` public class StreamSource `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/javax/xml/transform/Source `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | javax.xml.transform.stream.StreamSource |

<br />

*** ** * ** ***

<br />

Acts as an holder for a transformation Source in the form of a stream of XML markup.

*Note:* Due to their internal use of either a `https://developer.android.com/reference/java/io/Reader` or `https://developer.android.com/reference/java/io/InputStream` instance, `StreamSource` instances may only be used once.

<br />

## Summary

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#FEATURE` If `https://developer.android.com/reference/javax/xml/transform/TransformerFactory#getFeature(java.lang.String)` returns true when passed this value as an argument, the Transformer supports Source input of this type. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#StreamSource()() ` <br /> Zero-argument default constructor. |
| ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#StreamSource(java.io.File)(https://developer.android.com/reference/java/io/File f) ` Construct a StreamSource from a File. |
| ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#StreamSource(java.io.InputStream)(https://developer.android.com/reference/java/io/InputStream inputStream) ` Construct a StreamSource from a byte stream. |
| ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#StreamSource(java.io.InputStream,%20java.lang.String)(https://developer.android.com/reference/java/io/InputStream inputStream, https://developer.android.com/reference/java/lang/String systemId) ` Construct a StreamSource from a byte stream. |
| ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#StreamSource(java.io.Reader)(https://developer.android.com/reference/java/io/Reader reader) ` Construct a StreamSource from a character reader. |
| ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#StreamSource(java.io.Reader,%20java.lang.String)(https://developer.android.com/reference/java/io/Reader reader, https://developer.android.com/reference/java/lang/String systemId) ` Construct a StreamSource from a character reader. |
| ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#StreamSource(java.lang.String)(https://developer.android.com/reference/java/lang/String systemId) ` Construct a StreamSource from a URL. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/java/io/InputStream` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#getInputStream()() ` Get the byte stream that was set with setByteStream. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#getPublicId()() ` Get the public identifier that was set with setPublicId. |
| ` https://developer.android.com/reference/java/io/Reader` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#getReader()() ` Get the character stream that was set with setReader. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#getSystemId()() ` Get the system identifier that was set with setSystemId. |
| ` void` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#setInputStream(java.io.InputStream)(https://developer.android.com/reference/java/io/InputStream inputStream) ` Set the byte stream to be used as input. |
| ` void` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#setPublicId(java.lang.String)(https://developer.android.com/reference/java/lang/String publicId) ` Set the public identifier for this Source. |
| ` void` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#setReader(java.io.Reader)(https://developer.android.com/reference/java/io/Reader reader) ` Set the input to be a character reader. |
| ` void` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#setSystemId(java.lang.String)(https://developer.android.com/reference/java/lang/String systemId) ` Set the system identifier for this Source. |
| ` void` | ` https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#setSystemId(java.io.File)(https://developer.android.com/reference/java/io/File f) ` Set the system ID from a File reference. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/javax/xml/transform/Source ` ` abstract https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/javax/xml/transform/Source#getSystemId()() `

Get the system identifier that was set with setSystemId.
` abstract void` ` https://developer.android.com/reference/javax/xml/transform/Source#setSystemId(java.lang.String)(https://developer.android.com/reference/java/lang/String systemId) `

Set the system identifier for this Source.

## Constants

### FEATURE

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String FEATURE
```

If `https://developer.android.com/reference/javax/xml/transform/TransformerFactory#getFeature(java.lang.String)` returns true when passed this value as an argument, the Transformer supports Source input of this type.

<br />

Constant Value: "http://javax.xml.transform.stream.StreamSource/feature"

## Public constructors

### StreamSource

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StreamSource ()
```

<br />

Zero-argument default constructor. If this constructor is used, and no Stream source is set using `https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#setInputStream(java.io.InputStream)` or `https://developer.android.com/reference/javax/xml/transform/stream/StreamSource#setReader(java.io.Reader)`, then the `Transformer` will create an empty source `https://developer.android.com/reference/java/io/InputStream` using `https://developer.android.com/reference/java/io/InputStream#InputStream()`.

<br />

<br />

**See also:**

- `https://developer.android.com/reference/javax/xml/transform/Transformer#transform(javax.xml.transform.Source,%20javax.xml.transform.Result)`

### StreamSource

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StreamSource (File f)
```

Construct a StreamSource from a File.

<br />

| Parameters ||
|---|---|
| `f` | `File`: Must a non-null File reference. <br /> |

### StreamSource

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StreamSource (InputStream inputStream)
```

Construct a StreamSource from a byte stream. Normally, a stream should be used rather than a reader, so the XML parser can resolve character encoding specified by the XML declaration.

If this constructor is used to process a stylesheet, normally setSystemId should also be called, so that relative URI references can be resolved.

<br />

<br />

| Parameters ||
|---|---|
| `inputStream` | `InputStream`: A valid InputStream reference to an XML stream. <br /> |

### StreamSource

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StreamSource (InputStream inputStream, 
                String systemId)
```

Construct a StreamSource from a byte stream. Normally, a stream should be used rather than a reader, so that the XML parser can resolve character encoding specified by the XML declaration.

This constructor allows the systemID to be set in addition to the input stream, which allows relative URIs to be processed.

<br />

<br />

| Parameters ||
|---|---|
| `inputStream` | `InputStream`: A valid InputStream reference to an XML stream. <br /> |
| `systemId` | `String`: Must be a String that conforms to the URI syntax. <br /> |

### StreamSource

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StreamSource (Reader reader)
```

Construct a StreamSource from a character reader. Normally, a stream should be used rather than a reader, so that the XML parser can resolve character encoding specified by the XML declaration. However, in many cases the encoding of the input stream is already resolved, as in the case of reading XML from a StringReader.

<br />

| Parameters ||
|---|---|
| `reader` | `Reader`: A valid Reader reference to an XML character stream. <br /> |

### StreamSource

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StreamSource (Reader reader, 
                String systemId)
```

Construct a StreamSource from a character reader. Normally, a stream should be used rather than a reader, so that the XML parser may resolve character encoding specified by the XML declaration. However, in many cases the encoding of the input stream is already resolved, as in the case of reading XML from a StringReader.

<br />

| Parameters ||
|---|---|
| `reader` | `Reader`: A valid Reader reference to an XML character stream. <br /> |
| `systemId` | `String`: Must be a String that conforms to the URI syntax. <br /> |

### StreamSource

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public StreamSource (String systemId)
```

Construct a StreamSource from a URL.

<br />

| Parameters ||
|---|---|
| `systemId` | `String`: Must be a String that conforms to the URI syntax. <br /> |

## Public methods

### getInputStream

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public InputStream getInputStream ()
```

Get the byte stream that was set with setByteStream.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/io/InputStream` | The byte stream that was set with setByteStream, or null if setByteStream or the ByteStream constructor was not called. <br /> |

### getPublicId

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getPublicId ()
```

Get the public identifier that was set with setPublicId.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The public identifier that was set with setPublicId, or null if setPublicId was not called. <br /> |

### getReader

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Reader getReader ()
```

Get the character stream that was set with setReader.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/io/Reader` | The character stream that was set with setReader, or null if setReader or the Reader constructor was not called. <br /> |

### getSystemId

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getSystemId ()
```

Get the system identifier that was set with setSystemId.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The system identifier that was set with setSystemId, or null if setSystemId was not called. <br /> |

### setInputStream

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setInputStream (InputStream inputStream)
```

Set the byte stream to be used as input. Normally, a stream should be used rather than a reader, so that the XML parser can resolve character encoding specified by the XML declaration.

If this Source object is used to process a stylesheet, normally setSystemId should also be called, so that relative URL references can be resolved.

<br />

<br />

| Parameters ||
|---|---|
| `inputStream` | `InputStream`: A valid InputStream reference to an XML stream. <br /> |

### setPublicId

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setPublicId (String publicId)
```

Set the public identifier for this Source.

The public identifier is always optional: if the application writer includes one, it will be provided as part of the location information.

<br />

<br />

| Parameters ||
|---|---|
| `publicId` | `String`: The public identifier as a string. <br /> |

### setReader

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setReader (Reader reader)
```

Set the input to be a character reader. Normally, a stream should be used rather than a reader, so that the XML parser can resolve character encoding specified by the XML declaration. However, in many cases the encoding of the input stream is already resolved, as in the case of reading XML from a StringReader.

<br />

| Parameters ||
|---|---|
| `reader` | `Reader`: A valid Reader reference to an XML CharacterStream. <br /> |

### setSystemId

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setSystemId (String systemId)
```

Set the system identifier for this Source.

The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if there is no byte stream or character stream specified).

<br />

<br />

| Parameters ||
|---|---|
| `systemId` | `String`: The system identifier as a URL string. <br /> |

### setSystemId

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setSystemId (File f)
```

Set the system ID from a File reference.

<br />

| Parameters ||
|---|---|
| `f` | `File`: Must a non-null File reference. <br /> |