net.netheos.pcsapi.bytesio
Class FileByteSink

java.lang.Object
  extended by net.netheos.pcsapi.bytesio.FileByteSink
All Implemented Interfaces:
ByteSink

public class FileByteSink
extends Object
implements ByteSink

ByteSink where bytes are written to a file


Constructor Summary
FileByteSink(File file)
           
FileByteSink(File file, boolean tempName, boolean deleteOnAbort, boolean appended)
           
 
Method Summary
 ByteSinkStream openStream()
          Returns a ByteSinkStream object for writing data, to be closed by caller.
 void setExpectedLength(long expectedLength)
          Defines the number of bytes that are expected to be written to the stream.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileByteSink

public FileByteSink(File file)

FileByteSink

public FileByteSink(File file,
                    boolean tempName,
                    boolean deleteOnAbort,
                    boolean appended)
Parameters:
file - name of output file
appended - if true, file is appended else file is overwritten
tempName - if true, data will first be written to tempfile "filename.part" and when this file stream is closed properly (without having been aborted) it is renamed to "filename"
deleteOnAbort - if true, created file is deleted if stream is aborted or not closed properly.
Method Detail

setExpectedLength

public void setExpectedLength(long expectedLength)
Description copied from interface: ByteSink
Defines the number of bytes that are expected to be written to the stream. This value may be defined lately (after stream creation)

Note that this length may differ from the final data size, for example if bytes are appended to an already existing file.

Specified by:
setExpectedLength in interface ByteSink

openStream

public ByteSinkStream openStream()
                          throws FileNotFoundException
Description copied from interface: ByteSink
Returns a ByteSinkStream object for writing data, to be closed by caller. This method may be called several times (in case of retries)"

Specified by:
openStream in interface ByteSink
Returns:
ByteSinkStream
Throws:
FileNotFoundException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All Rights Reserved.