com.ddtek.xmlconverter
Class OutputResult

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

public class OutputResult
extends StreamResult

The class OutputResult is used to specify that the user of Converter wants the Converter to write its output to a Writer provided by the caller, or wants the Converter to write its output to a OutputStream provided by the caller using a specified byte encoding. The Converter never closes the Writer or OutputStream provided by the caller; the caller must do this after the conversion is finished.


Field Summary
 
Fields inherited from class javax.xml.transform.stream.StreamResult
FEATURE
 
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
OutputResult()
          Default constructor.
OutputResult(OutputStream outputStream)
          Construct an OutputResult from a byte stream (OutputStream).
OutputResult(String systemId)
          Construct an OutputResult from a URI.
OutputResult(Writer writer)
          Construct an OutputResult from a character stream (Writer).
 
Method Summary
 String getEncoding()
          Get the character encoding for a byte stream or URI.
 void setEncoding(String encoding)
          Set the character encoding.
 
Methods inherited from class javax.xml.transform.stream.StreamResult
getOutputStream, getSystemId, getWriter, setOutputStream, setSystemId, setSystemId, setWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputResult

public OutputResult()
Default constructor. If this constructor is used, the caller must call setWriter to specify the Writer to be used, or call setOutputStream and setEncoding to specify the OutputStream and encoding.


OutputResult

public OutputResult(OutputStream outputStream)
Construct an OutputResult from a byte stream (OutputStream). Normally, the caller should also call setEncoding to specify the encoding.

Parameters:
outputStream - The OutputStream created by the caller.

OutputResult

public OutputResult(Writer writer)
Construct an OutputResult from a character stream (Writer). If the Writer is a OutputStreamWriter, the Converter will is to determine the correct encoding. Otherwise, the caller must also call setEncoding to specify the encoding

Parameters:
writer - The Writer to which data is written.

OutputResult

public OutputResult(String systemId)
Construct an OutputResult from a URI. If this constructor is used, the caller must call setWriter to specify the Writer to be used, or call setOutputStream and setEncoding to specify the OutputStream and encoding.

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

setEncoding

public void setEncoding(String encoding)
Set the character encoding.

The encoding must be a valid XML encoding declaration (see section 4.3.3 of the XML 1.0 recommendation).

Parameters:
encoding - A string describing the character encoding.
See Also:
getEncoding()

getEncoding

public String getEncoding()
Get the character encoding for a byte stream or URI.

Returns:
The encoding, or null if none was supplied.
See Also:
setEncoding(java.lang.String)