public class AIOSequentialFile extends AbstractSequentialFile
AbstractSequentialFile.LocalBufferObserver
directory, factory, fileSize, position, timedBuffer, timedBufferObserver, writerExecutor
Constructor and Description |
---|
AIOSequentialFile(AIOSequentialFileFactory factory,
int bufferSize,
long bufferTimeoutMilliseconds,
File directory,
String fileName,
Executor writerExecutor) |
Modifier and Type | Method and Description |
---|---|
int |
calculateBlockStart(int position) |
SequentialFile |
cloneFile() |
void |
close() |
void |
fill(int size) |
int |
getAlignment() |
boolean |
isOpen() |
protected ByteBuffer |
newBuffer(int size,
int limit) |
void |
open() |
void |
open(int maxIO,
boolean useExecutor)
The maximum number of simultaneous writes accepted
|
int |
read(ByteBuffer bytes) |
int |
read(ByteBuffer bytes,
IOCallback callback) |
long |
size() |
void |
sync() |
String |
toString() |
void |
writeDirect(ByteBuffer bytes,
boolean sync)
Write directly to the file without using intermediate any buffer
|
void |
writeDirect(ByteBuffer bytes,
boolean sync,
IOCallback callback)
Note: Parameter sync is not used on AIO
|
copyTo, delete, exists, fits, getFile, getFileName, getJavaFile, position, position, renameTo, setTimedBuffer, write, write, write, write
public AIOSequentialFile(AIOSequentialFileFactory factory, int bufferSize, long bufferTimeoutMilliseconds, File directory, String fileName, Executor writerExecutor)
public boolean isOpen()
public int getAlignment()
public int calculateBlockStart(int position)
public SequentialFile cloneFile()
public void close() throws IOException, InterruptedException, ActiveMQException
close
in interface SequentialFile
close
in class AbstractSequentialFile
IOException
- we declare throwing IOException because sub-classes need to do itInterruptedException
ActiveMQException
public void open(int maxIO, boolean useExecutor) throws ActiveMQException
SequentialFile
ActiveMQException
public int read(ByteBuffer bytes, IOCallback callback) throws ActiveMQException
bytes
- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int)
.ActiveMQException
public int read(ByteBuffer bytes) throws Exception
bytes
- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int)
.Exception
public void writeDirect(ByteBuffer bytes, boolean sync) throws Exception
SequentialFile
bytes
- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int)
.Exception
public void writeDirect(ByteBuffer bytes, boolean sync, IOCallback callback)
bytes
- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int)
.public void sync()
protected ByteBuffer newBuffer(int size, int limit)
newBuffer
in class AbstractSequentialFile
Copyright © 2016 JBoss by Red Hat. All rights reserved.