at.gv.egiz.pdfas.io
Class FileBasedDataSink

java.lang.Object
  extended byat.gv.egiz.pdfas.io.FileBasedDataSink
All Implemented Interfaces:
DataSink, FileBased

public class FileBasedDataSink
extends Object
implements DataSink, FileBased

Author:
wprinz

Field Summary
protected  String characterEncoding
           
protected  File file
           
protected  String mimeType
           
 
Constructor Summary
FileBasedDataSink(File file)
           
 
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.
 File getFile()
          Returns the File "behind" this io element.
 String getMimeType()
          Returns the mime type of the data stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected File file

mimeType

protected String mimeType

characterEncoding

protected String characterEncoding
Constructor Detail

FileBasedDataSink

public FileBasedDataSink(File file)
                  throws IOException
Parameters:
file -
Throws:
IOException
Method Detail

createOutputStream

public OutputStream createOutputStream(String mimeType)
                                throws FileNotFoundException
Description copied from interface: DataSink
Creates an OutputStream for binary data.

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

Specified by:
createOutputStream in interface DataSink
Parameters:
mimeType - The mime type of the output data.
Returns:
Returns the created output stream.
Throws:
FileNotFoundException
See Also:
DataSink.createOutputStream(java.lang.String)

createOutputStream

public OutputStream createOutputStream(String mimeType,
                                       String characterEncoding)
                                throws FileNotFoundException
Description copied from interface: DataSink
Creates an OutputStream for character data.

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

Specified by:
createOutputStream in interface DataSink
Parameters:
mimeType - The mime type of the output data.
characterEncoding - The character encoding of the data.
Returns:
Returns the created output stream.
Throws:
FileNotFoundException
See Also:
DataSink.createOutputStream(java.lang.String, java.lang.String)

getMimeType

public String getMimeType()
Description copied from interface: DataSink
Returns the mime type of the data stream.

This is only valid after a stream has been created.

Specified by:
getMimeType in interface DataSink
Returns:
Returns the mime type of the data stream.
See Also:
DataSink.getMimeType()

getCharacterEncoding

public String getCharacterEncoding()
Description copied from interface: DataSink
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).

Specified by:
getCharacterEncoding in interface DataSink
Returns:
Returns the character encoding of the data stream.
See Also:
DataSink.getCharacterEncoding()

getFile

public File getFile()
Description copied from interface: FileBased
Returns the File "behind" this io element.

This is usually used to determine the file name itself.

Specified by:
getFile in interface FileBased
Returns:
Returns the File "behind" this io element.
See Also:
FileBased.getFile()


Copyright © 2006-2010. All Rights Reserved.