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:
getOutputStream
in interfaceuk.ac.starlink.table.ByteStore
-
getLength
public long getLength()- Specified by:
getLength
in interfaceuk.ac.starlink.table.ByteStore
-
copy
- Specified by:
copy
in interfaceuk.ac.starlink.table.ByteStore
- Throws:
IOException
-
toByteBuffers
- Specified by:
toByteBuffers
in interfaceuk.ac.starlink.table.ByteStore
- Throws:
IOException
-
close
public void close()- Specified by:
close
in interfaceuk.ac.starlink.table.ByteStore
-