net.netheos.pcsapi.bytesio
Class FileByteSink
java.lang.Object
net.netheos.pcsapi.bytesio.FileByteSink
- All Implemented Interfaces:
- ByteSink
public class FileByteSink
- extends Object
- implements ByteSink
ByteSink where bytes are written to a file
FileByteSink
public FileByteSink(File file)
FileByteSink
public FileByteSink(File file,
boolean tempName,
boolean deleteOnAbort,
boolean appended)
- Parameters:
file - name of output fileappended - if true, file is appended else file is overwrittentempName - 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.
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.