Package uk.ac.starlink.ttools.plot2.data
Class MoveFileByteStore
java.lang.Object
uk.ac.starlink.ttools.plot2.data.MoveFileByteStore
- All Implemented Interfaces:
uk.ac.starlink.table.ByteStore
ByteStore that stores data in a named file which appears completely
populated in the filesystem. This works in a similar way to
FileByteStore, but it writes
to a temporary file, and when it's complete it renames it to the
requested destination file.
The point of this is so that two copies of the same named file are
being written at once, they will not interfere with each other.
This implementation interferes slightly with the implicit contract
of ByteStore, in that all the writing to the output stream has to
be complete before a call to copy(java.io.OutputStream) or toByteBuffers(),
but that's what you'd do in normal usage anyway.
- Since:
- 8 Jan 2020
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
MoveFileByteStore
Constructor.- Parameters:
file- destination filename- Throws:
IOException
-
-
Method Details
-
getOutputStream
- Specified by:
getOutputStreamin interfaceuk.ac.starlink.table.ByteStore
-
getLength
public long getLength()- Specified by:
getLengthin interfaceuk.ac.starlink.table.ByteStore
-
copy
- Specified by:
copyin interfaceuk.ac.starlink.table.ByteStore- Throws:
IOException
-
toByteBuffers
- Specified by:
toByteBuffersin interfaceuk.ac.starlink.table.ByteStore- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceuk.ac.starlink.table.ByteStore
-