javax.xml.transform.stream

Class StreamResult

Implemented Interfaces:
Result

public class StreamResult
extends java.lang.Object
implements Result

Specifies a stream to which to write the transformation result.

Field Summary

static String
FEATURE
Factory feature indicating that stream results are supported.

Fields inherited from interface javax.xml.transform.Result

PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING

Constructor Summary

StreamResult()
Default constructor.
StreamResult(File file)
Constructor with a system ID specified as a File object.
StreamResult(OutputStream stream)
Constructor with an output stream.
StreamResult(String systemID)
Constructor with a system ID.
StreamResult(Writer writer)
Constructor with a writer.

Method Summary

OutputStream
getOutputStream()
Returns the target output stream.
String
getSystemId()
Returns the system ID.
Writer
getWriter()
Returns the target writer.
void
setOutputStream(OutputStream outputStream)
Sets the target output stream.
void
setSystemId(File f)
Sets the system ID from a File reference.
void
setSystemId(String systemID)
Sets the system ID.
void
setWriter(Writer writer)
Sets the target writer.

Field Details

FEATURE

public static final String FEATURE
Factory feature indicating that stream results are supported.

Constructor Details

StreamResult

public StreamResult()
Default constructor.


StreamResult

public StreamResult(File file)
Constructor with a system ID specified as a File object.


StreamResult

public StreamResult(OutputStream stream)
Constructor with an output stream.


StreamResult

public StreamResult(String systemID)
Constructor with a system ID.


StreamResult

public StreamResult(Writer writer)
Constructor with a writer. Prefer to use an output stream rather than a writer, so that the output encoding can be controlled by transformation properties.

Method Details

getOutputStream

public OutputStream getOutputStream()
Returns the target output stream.


getSystemId

public String getSystemId()
Returns the system ID.
Specified by:
getSystemId in interface Result


getWriter

public Writer getWriter()
Returns the target writer.


setOutputStream

public void setOutputStream(OutputStream outputStream)
Sets the target output stream.


setSystemId

public void setSystemId(File f)
Sets the system ID from a File reference.


setSystemId

public void setSystemId(String systemID)
Sets the system ID. If neither the out stream nor the writer have been specified, the system ID will be treated as a URL for writing to.
Specified by:
setSystemId in interface Result


setWriter

public void setWriter(Writer writer)
Sets the target writer. Prefer to use an output stream rather than a writer, so that the output encoding can be controlled by transformation properties.