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
public class MoveFileByteStore extends java.lang.Object implements uk.ac.starlink.table.ByteStoreByteStore that stores data in a named file which appears completely populated in the filesystem. This works in a similar way toFileByteStore, 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)ortoByteBuffers(), but that's what you'd do in normal usage anyway.- Since:
- 8 Jan 2020
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description MoveFileByteStore(java.io.File file)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcopy(java.io.OutputStream out)longgetLength()java.io.OutputStreamgetOutputStream()java.nio.ByteBuffer[]toByteBuffers()
-
-
-
Method Detail
-
getOutputStream
public java.io.OutputStream getOutputStream()
- Specified by:
getOutputStreamin interfaceuk.ac.starlink.table.ByteStore
-
getLength
public long getLength()
- Specified by:
getLengthin interfaceuk.ac.starlink.table.ByteStore
-
copy
public void copy(java.io.OutputStream out) throws java.io.IOException- Specified by:
copyin interfaceuk.ac.starlink.table.ByteStore- Throws:
java.io.IOException
-
toByteBuffers
public java.nio.ByteBuffer[] toByteBuffers() throws java.io.IOException- Specified by:
toByteBuffersin interfaceuk.ac.starlink.table.ByteStore- Throws:
java.io.IOException
-
close
public void close()
- Specified by:
closein interfaceuk.ac.starlink.table.ByteStore
-
-