com.xmlmind.fo.converter
Class OutputDestination

java.lang.Object
  extended by com.xmlmind.fo.converter.OutputDestination
All Implemented Interfaces:
Cloneable

public class OutputDestination
extends Object
implements Cloneable

A conversion output destination.

This class is used to specify a destination for the conversion output. It encapsulates all destination types in a single object, which may include a byte stream, a character stream or a file name. When a byte stream or a file name is specified, an optional character encoding may be specified as well.

If a character stream is supplied, conversion output will be directed to that stream. Else if a byte stream is supplied the converter will use that stream, using the specified encoding if any. Else if a file name is supplied the converter will write to that file, using the specified encoding if any. If neither a stream or file name is supplied, the converter will use Standard Output as a byte stream.


Constructor Summary
OutputDestination()
          No-argument default constructor.
OutputDestination(OutputStream byteStream)
          Creates an output destination with a byte stream.
OutputDestination(String fileName)
          Creates an output destination with a file name.
OutputDestination(Writer characterStream)
          Creates an output destination with a character stream.
 
Method Summary
 OutputDestination copy()
          Returns a copy of this output destination.
 OutputStream getByteStream()
          Gets the byte stream of this output destination.
 Writer getCharacterStream()
          Gets the character stream of this output destination.
 String getEncoding()
          Gets the encoding of this output destination.
 String getFileName()
          Gets the file name of this output destination.
 void setByteStream(OutputStream byteStream)
          Sets the byte stream of this output destination.
 void setCharacterStream(Writer characterStream)
          Sets the character stream of this output destination.
 void setEncoding(String encoding)
          Sets the encoding of this output destination.
 void setFileName(String fileName)
          Sets the file name of this output destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputDestination

public OutputDestination()
No-argument default constructor.


OutputDestination

public OutputDestination(String fileName)
Creates an output destination with a file name.

Applications may use the setEncoding method to specify a character encoding.

Parameters:
fileName - the file name
See Also:
setEncoding

OutputDestination

public OutputDestination(OutputStream byteStream)
Creates an output destination with a byte stream.

Applications may use the setEncoding method to specify a character encoding.

Parameters:
byteStream - the byte stream
See Also:
setEncoding

OutputDestination

public OutputDestination(Writer characterStream)
Creates an output destination with a character stream.

Parameters:
characterStream - the character stream
Method Detail

getFileName

public String getFileName()
Gets the file name of this output destination.

Returns:
the file name, or null if none was supplied.
See Also:
setFileName

getEncoding

public String getEncoding()
Gets the encoding of this output destination.

Returns:
the encoding, or null if none was supplied.
See Also:
setEncoding

getByteStream

public OutputStream getByteStream()
Gets the byte stream of this output destination.

Returns:
the byte stream, or null if none was supplied.
See Also:
setByteStream

getCharacterStream

public Writer getCharacterStream()
Gets the character stream of this output destination.

Returns:
the character stream, or null if none was supplied.
See Also:
setCharacterStream

setFileName

public void setFileName(String fileName)
Sets the file name of this output destination.

Parameters:
fileName - the file name
See Also:
getFileName

setEncoding

public void setEncoding(String encoding)
Sets the encoding of this output destination.

Parameters:
encoding - the encoding
See Also:
getEncoding

setByteStream

public void setByteStream(OutputStream byteStream)
Sets the byte stream of this output destination.

Parameters:
byteStream - the byte stream
See Also:
getByteStream

setCharacterStream

public void setCharacterStream(Writer characterStream)
Sets the character stream of this output destination.

Parameters:
characterStream - the character stream
See Also:
getCharacterStream

copy

public OutputDestination copy()
Returns a copy of this output destination.

Returns:
a copy of this output destination