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(java.lang.Runnable run)static longappendTo(java.nio.file.Path src, java.nio.file.Path dst)voidblockingWriteDirect(java.nio.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)java.lang.StringgetFileName()java.io.FilegetJavaFile()Returns a native File of the file underlying this sequential file.booleanisOpen()java.nio.ByteBuffermap(int position, long size)voidopen()voidopen(int maxIO, boolean useExecutor)The maximum number of simultaneous writes acceptedlongposition()voidposition(long pos)intread(java.nio.ByteBuffer bytes)intread(java.nio.ByteBuffer bytes, IOCallback callback)voidrenameTo(java.lang.String newFileName)voidsetTimedBuffer(TimedBuffer buffer)longsize()voidsync()voidwrite(org.apache.activemq.artemis.api.core.ActiveMQBuffer bytes, boolean sync)voidwrite(org.apache.activemq.artemis.api.core.ActiveMQBuffer bytes, boolean sync, IOCallback callback)voidwrite(EncodingSupport bytes, boolean sync)voidwrite(EncodingSupport bytes, boolean sync, IOCallback callback)voidwriteDirect(java.nio.ByteBuffer bytes, boolean sync)Write directly to the file without using intermediate any buffervoidwriteDirect(java.nio.ByteBuffer bytes, boolean sync, IOCallback callback)Write directly to the file without using any buffer
-
-
-
Method Detail
-
isOpen
boolean isOpen()
-
exists
boolean exists()
-
open
void open() throws java.lang.Exception
- Throws:
java.lang.Exception
-
afterComplete
default void afterComplete(java.lang.Runnable run)
-
open
void open(int maxIO, boolean useExecutor) throws java.lang.ExceptionThe maximum number of simultaneous writes accepted- Parameters:
maxIO-- Throws:
java.lang.Exception
-
map
java.nio.ByteBuffer map(int position, long size) throws java.io.IOException- Throws:
java.io.IOException
-
fits
boolean fits(int size)
-
calculateBlockStart
int calculateBlockStart(int position) throws java.lang.Exception- Throws:
java.lang.Exception
-
getFileName
java.lang.String getFileName()
-
fill
void fill(int size) throws java.lang.Exception
- Throws:
java.lang.Exception
-
delete
void delete() throws java.io.IOException, java.lang.InterruptedException, org.apache.activemq.artemis.api.core.ActiveMQException- Throws:
java.io.IOExceptionjava.lang.InterruptedExceptionorg.apache.activemq.artemis.api.core.ActiveMQException
-
write
void write(org.apache.activemq.artemis.api.core.ActiveMQBuffer bytes, boolean sync, IOCallback callback) throws java.lang.Exception- Throws:
java.lang.Exception
-
write
void write(org.apache.activemq.artemis.api.core.ActiveMQBuffer bytes, boolean sync) throws java.lang.Exception- Throws:
java.lang.Exception
-
write
void write(EncodingSupport bytes, boolean sync, IOCallback callback) throws java.lang.Exception
- Throws:
java.lang.Exception
-
write
void write(EncodingSupport bytes, boolean sync) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeDirect
void writeDirect(java.nio.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(java.nio.ByteBuffer bytes, boolean sync) throws java.lang.ExceptionWrite 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:
java.lang.Exception
-
blockingWriteDirect
void blockingWriteDirect(java.nio.ByteBuffer bytes, boolean sync, boolean releaseBuffer) throws java.lang.ExceptionWrite 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:
java.lang.Exception
-
read
int read(java.nio.ByteBuffer bytes, IOCallback callback) throws java.lang.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:
java.lang.Exception
-
read
int read(java.nio.ByteBuffer bytes) throws java.lang.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:
java.lang.Exception
-
position
void position(long pos) throws java.io.IOException- Throws:
java.io.IOException
-
position
long position()
-
close
void close() throws java.lang.Exception- Throws:
java.lang.Exception
-
close
default void close(boolean waitSync, boolean blockOnWait) throws java.lang.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:
java.lang.Exception
-
sync
void sync() throws java.io.IOException
- Throws:
java.io.IOException
-
size
long size() throws java.lang.Exception
- Throws:
java.lang.Exception
-
renameTo
void renameTo(java.lang.String newFileName) throws java.lang.Exception- Throws:
java.lang.Exception
-
cloneFile
SequentialFile cloneFile()
-
copyTo
void copyTo(SequentialFile newFileName) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setTimedBuffer
void setTimedBuffer(TimedBuffer buffer)
-
getJavaFile
java.io.File getJavaFile()
Returns a native File of the file underlying this sequential file.
-
appendTo
static long appendTo(java.nio.file.Path src, java.nio.file.Path dst) throws java.io.IOException- Throws:
java.io.IOException
-
-