at.gv.egiz.pdfas.api.io
Interface DataSink

All Known Implementing Classes:
ByteArrayDataSink, FileBasedDataSink

public interface DataSink

Output document data sink.

Actually, the DataSink can be seen as a factory for creating OutputStreams with mime type and character encoding provided. This allows the API user to decide how data is to be stored (e.g. in a file, in a byte array, etc.).

Author:
wprinz

Method Summary
 OutputStream createOutputStream(String mimeType)
          Creates an OutputStream for binary data.
 OutputStream createOutputStream(String mimeType, String characterEncoding)
          Creates an OutputStream for character data.
 String getCharacterEncoding()
          Returns the character encoding of the data stream.
 String getMimeType()
          Returns the mime type of the data stream.
 

Method Detail

createOutputStream

public OutputStream createOutputStream(String mimeType)
                                throws IOException
Creates an OutputStream for binary data.

Note that the stream may be written only once. Creating another stream overwrites the existing one.

Parameters:
mimeType - The mime type of the output data.
Returns:
Returns the created output stream.
Throws:
IOException - Thrown if the stream cannot be created.

createOutputStream

public OutputStream createOutputStream(String mimeType,
                                       String characterEncoding)
                                throws IOException
Creates an OutputStream for character data.

This is basically the same as createOutputStream(String), but allows to specify the character encoding.

Parameters:
mimeType - The mime type of the output data.
characterEncoding - The character encoding of the data.
Returns:
Returns the created output stream.
Throws:
IOException - Thrown if the stream cannot be created.

getMimeType

public String getMimeType()
Returns the mime type of the data stream.

This is only valid after a stream has been created.

Returns:
Returns the mime type of the data stream.

getCharacterEncoding

public String getCharacterEncoding()
Returns the character encoding of the data stream.

This is only valid after a stream has been created. Null means that no character encoding was specified for the data (e.g. if the data is binary).

Returns:
Returns the character encoding of the data stream.


Copyright © 2006-2010. All Rights Reserved.