public class NIOSequentialFile extends AbstractSequentialFile
AbstractSequentialFile.LocalBufferObserver
directory, factory, fileSize, position, timedBuffer, timedBufferObserver
Constructor and Description |
---|
NIOSequentialFile(SequentialFileFactory factory,
File directory,
String file,
int maxIO,
Executor writerExecutor) |
Modifier and Type | Method and Description |
---|---|
int |
calculateBlockStart(int position) |
SequentialFile |
cloneFile() |
void |
close() |
void |
copyTo(SequentialFile dstFile) |
void |
fill(int size) |
boolean |
isOpen() |
protected ByteBuffer |
newBuffer(int size,
int limit) |
void |
open()
this.maxIO represents the default maxIO.
|
void |
open(int maxIO,
boolean useExecutor)
The maximum number of simultaneous writes accepted
|
void |
position(long pos) |
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)
Write directly to the file without using any buffer
|
delete, exists, fits, getFile, getFileName, getJavaFile, position, renameTo, setTimedBuffer, write, write, write, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close
public NIOSequentialFile(SequentialFileFactory factory, File directory, String file, int maxIO, Executor writerExecutor)
public int calculateBlockStart(int position)
public boolean isOpen()
public void open() throws IOException
IOException
public void open(int maxIO, boolean useExecutor) throws IOException
SequentialFile
IOException
public void fill(int size) throws IOException
IOException
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 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 int read(ByteBuffer bytes, IOCallback callback) throws IOException, ActiveMQIllegalStateException
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)
.IOException
ActiveMQIllegalStateException
public void sync() throws IOException
IOException
public long size() throws IOException
IOException
public void position(long pos) throws IOException
position
in interface SequentialFile
position
in class AbstractSequentialFile
IOException
- only declare exception due to signature. Sub-class needs it.public SequentialFile cloneFile()
public void writeDirect(ByteBuffer bytes, boolean sync, IOCallback callback)
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)
.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
protected ByteBuffer newBuffer(int size, int limit)
newBuffer
in class AbstractSequentialFile
public void copyTo(SequentialFile dstFile) throws IOException
copyTo
in interface SequentialFile
copyTo
in class AbstractSequentialFile
IOException
Copyright © 2018 JBoss by Red Hat. All rights reserved.