Interface SequentialFile
-
- All Known Implementing Classes:
AbstractSequentialFile,AIOSequentialFile,NIOSequentialFile
public interface SequentialFile
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidafterComplete(Runnable run)static longappendTo(Path src, Path dst)voidblockingWriteDirect(ByteBuffer bytes, boolean sync, boolean releaseBuffer)Write directly to the file without using any intermediate buffer and wait completion.
IfreleaseBufferistruethe providedbytesshould be released throughSequentialFileFactory.releaseBuffer(ByteBuffer), if supported.intcalculateBlockStart(int position)SequentialFilecloneFile()voidclose()default voidclose(boolean waitSync, boolean blockOnWait)When closing a file from a finalize block, you cant wait on syncs or anything like that.voidcopyTo(SequentialFile newFileName)voiddelete()booleanexists()voidfill(int size)booleanfits(int size)StringgetFileName()FilegetJavaFile()Returns a native File of the file underlying this sequential file.booleanisOpen()ByteBuffermap(int position, long size)voidopen()voidopen(int maxIO, boolean useExecutor)The maximum number of simultaneous writes acceptedlongposition()voidposition(long pos)intread(ByteBuffer bytes)intread(ByteBuffer bytes, IOCallback callback)voidrenameTo(String newFileName)voidsetTimedBuffer(TimedBuffer buffer)longsize()voidsync()voidwrite(ActiveMQBuffer bytes, boolean sync)voidwrite(ActiveMQBuffer bytes, boolean sync, IOCallback callback)voidwrite(EncodingSupport bytes, boolean sync)voidwrite(EncodingSupport bytes, boolean sync, IOCallback callback)voidwriteDirect(ByteBuffer bytes, boolean sync)Write directly to the file without using intermediate any buffervoidwriteDirect(ByteBuffer bytes, boolean sync, IOCallback callback)Write directly to the file without using any buffer
-
-
-
Method Detail
-
isOpen
boolean isOpen()
-
exists
boolean exists()
-
afterComplete
default void afterComplete(Runnable run)
-
open
void open(int maxIO, boolean useExecutor) throws ExceptionThe maximum number of simultaneous writes accepted- Parameters:
maxIO-- Throws:
Exception
-
map
ByteBuffer map(int position, long size) throws IOException
- Throws:
IOException
-
fits
boolean fits(int size)
-
getFileName
String getFileName()
-
delete
void delete() throws IOException, InterruptedException, ActiveMQException
-
write
void write(ActiveMQBuffer bytes, boolean sync, IOCallback callback) throws Exception
- Throws:
Exception
-
write
void write(ActiveMQBuffer bytes, boolean sync) throws Exception
- Throws:
Exception
-
write
void write(EncodingSupport bytes, boolean sync, IOCallback callback) throws Exception
- Throws:
Exception
-
write
void write(EncodingSupport bytes, boolean sync) throws Exception
- Throws:
Exception
-
writeDirect
void writeDirect(ByteBuffer bytes, boolean sync, IOCallback callback)
Write directly to the file without using any buffer- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). To be safe, use a buffer from the correspondingSequentialFileFactory.newBuffer(int).
-
writeDirect
void writeDirect(ByteBuffer bytes, boolean sync) throws Exception
Write directly to the file without using intermediate any buffer- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). To be safe, use a buffer from the correspondingSequentialFileFactory.newBuffer(int).- Throws:
Exception
-
blockingWriteDirect
void blockingWriteDirect(ByteBuffer bytes, boolean sync, boolean releaseBuffer) throws Exception
Write directly to the file without using any intermediate buffer and wait completion.
IfreleaseBufferistruethe providedbytesshould be released throughSequentialFileFactory.releaseBuffer(ByteBuffer), if supported.- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). IfreleaseBufferistrueuse a buffer fromSequentialFileFactory.newBuffer(int),SequentialFileFactory.allocateDirectBuffer(int)otherwise.sync- iftruewill durable flush the written data on the file,falseotherwisereleaseBuffer- iftruewill release the buffer,falseotherwise- Throws:
Exception
-
read
int read(ByteBuffer bytes, IOCallback callback) throws Exception
- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). To be safe, use a buffer from the correspondingSequentialFileFactory.newBuffer(int).- Throws:
Exception
-
read
int read(ByteBuffer bytes) throws Exception
- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). To be safe, use a buffer from the correspondingSequentialFileFactory.newBuffer(int).- Throws:
Exception
-
position
void position(long pos) throws IOException- Throws:
IOException
-
position
long position()
-
close
default void close(boolean waitSync, boolean blockOnWait) throws ExceptionWhen closing a file from a finalize block, you cant wait on syncs or anything like that. otherwise the VM may hung. Especially on the testsuite.- Throws:
Exception
-
sync
void sync() throws IOException
- Throws:
IOException
-
cloneFile
SequentialFile cloneFile()
-
copyTo
void copyTo(SequentialFile newFileName) throws Exception
- Throws:
Exception
-
setTimedBuffer
void setTimedBuffer(TimedBuffer buffer)
-
getJavaFile
File getJavaFile()
Returns a native File of the file underlying this sequential file.
-
appendTo
static long appendTo(Path src, Path dst) throws IOException
- Throws:
IOException
-
-