Interface SequentialFile
- All Known Implementing Classes:
AbstractSequentialFile,AIOSequentialFile,JDBCSequentialFile,NIOSequentialFile
public interface SequentialFile
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidafterComplete(Runnable run) static longvoidblockingWriteDirect(ByteBuffer bytes, boolean sync, boolean releaseBuffer) Write directly to the file without using any intermediate buffer and wait completion.intcalculateBlockStart(int position) voidclose()default voidclose(boolean waitSync, boolean blockOnWait) When closing a file from a finalize block, you cant wait on syncs or anything like that. otherwise the VM may hung.voidcopyTo(SequentialFile newFileName) voiddelete()booleanexists()voidfill(int size) booleanfits(int size) Returns a nativeFileof the file underlying this sequential file.booleanisOpen()map(int position, long size) voidopen()voidopen(int maxIO, boolean useExecutor) The maximum number of simultaneous writes acceptedlongposition()voidposition(long pos) intread(ByteBuffer bytes) Read the file.intread(ByteBuffer bytes, IOCallback callback) Read the file.voidvoidsetTimedBuffer(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 Details
-
isOpen
boolean isOpen() -
exists
boolean exists() -
open
- Throws:
Exception
-
afterComplete
-
open
The maximum number of simultaneous writes accepted- Throws:
Exception
-
map
- Throws:
IOException
-
fits
boolean fits(int size) -
calculateBlockStart
- Throws:
Exception
-
getFileName
String getFileName() -
fill
- Throws:
Exception
-
delete
-
write
- Throws:
Exception
-
write
- Throws:
Exception
-
write
- Throws:
Exception
-
write
- Throws:
Exception
-
writeDirect
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
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
Write directly to the file without using any intermediate buffer and wait completion.If
releaseBufferistruethe 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
Read the file.- 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
Read the file.- 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
- Throws:
IOException
-
position
long position() -
close
- Throws:
Exception
-
close
When 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
- Throws:
IOException
-
size
- Throws:
Exception
-
renameTo
- Throws:
Exception
-
cloneFile
SequentialFile cloneFile() -
copyTo
- Throws:
Exception
-
setTimedBuffer
-
getJavaFile
File getJavaFile()Returns a nativeFileof the file underlying this sequential file.- Returns:
- a native
Fileof the file underlying this sequential file
-
appendTo
- Throws:
IOException
-