public final class NIOSequentialFile extends AbstractSequentialFile
AbstractSequentialFile.LocalBufferObserverfactory, fileSize, position, timedBuffer, timedBufferObserver, writerExecutor| Constructor and Description |
|---|
NIOSequentialFile(SequentialFileFactory factory,
File file,
int maxIO,
Executor writerExecutor) |
NIOSequentialFile(SequentialFileFactory factory,
String directory,
String fileName,
int maxIO,
Executor writerExecutor) |
| Modifier and Type | Method and Description |
|---|---|
int |
calculateBlockStart(int position) |
SequentialFile |
cloneFile() |
void |
close() |
void |
fill(int position,
int size,
byte fillCharacter) |
int |
getAlignment() |
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,
IOAsyncTask callback) |
long |
size() |
void |
sync() |
String |
toString() |
void |
waitForClose() |
void |
writeDirect(ByteBuffer bytes,
boolean sync)
Write directly to the file without using any buffer
|
void |
writeDirect(ByteBuffer bytes,
boolean sync,
IOAsyncTask callback)
Write directly to the file without using any buffer
|
void |
writeInternal(ByteBuffer bytes)
Write directly to the file.
|
copyTo, delete, exists, fits, getFile, getFileName, getJavaFile, position, renameTo, setTimedBuffer, write, write, write, writepublic NIOSequentialFile(SequentialFileFactory factory, String directory, String fileName, int maxIO, Executor writerExecutor)
public NIOSequentialFile(SequentialFileFactory factory, File file, int maxIO, Executor writerExecutor)
public int getAlignment()
public int calculateBlockStart(int position)
public boolean isOpen()
public void open()
throws IOException
IOExceptionpublic void open(int maxIO,
boolean useExecutor)
throws IOException
SequentialFileIOExceptionpublic void fill(int position,
int size,
byte fillCharacter)
throws IOException
IOExceptionpublic void waitForClose()
throws InterruptedException
InterruptedExceptionpublic void close()
throws IOException,
InterruptedException,
HornetQException
close in interface SequentialFileclose in class AbstractSequentialFileIOException - we declare throwing IOException because sub-classes need to do itInterruptedExceptionHornetQExceptionpublic 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).Exceptionpublic int read(ByteBuffer bytes, IOAsyncTask callback) throws IOException, HornetQIllegalStateException
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).IOExceptionHornetQIllegalStateExceptionpublic void sync()
throws IOException
IOExceptionpublic long size()
throws IOException
IOExceptionpublic void position(long pos)
throws IOException
position in interface SequentialFileposition in class AbstractSequentialFileIOException - only declare exception due to signature. Sub-class needs it.public SequentialFile cloneFile()
public void writeDirect(ByteBuffer bytes, boolean sync, IOAsyncTask callback)
SequentialFilebytes - 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
SequentialFilebytes - the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int).Exceptionpublic void writeInternal(ByteBuffer bytes) throws Exception
SequentialFilebytes - the ByteBuffer must be compatible with the SequentialFile implementation (AIO or
NIO). To be safe, use a buffer from the corresponding
SequentialFileFactory.newBuffer(int).Exceptionprotected ByteBuffer newBuffer(int size, int limit)
newBuffer in class AbstractSequentialFileCopyright © 2013 JBoss, a division of Red Hat. All rights reserved.