public abstract class AbstractSequentialFile extends Object implements SequentialFile
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractSequentialFile.LocalBufferObserver |
| Modifier and Type | Field and Description |
|---|---|
protected File |
directory |
protected SequentialFileFactory |
factory |
protected long |
fileSize |
protected AtomicLong |
position |
protected TimedBuffer |
timedBuffer |
protected TimedBufferObserver |
timedBufferObserver
Instead of having AIOSequentialFile implementing the Observer, I have done it on an inner class.
|
| Constructor and Description |
|---|
AbstractSequentialFile(File directory,
String file,
SequentialFileFactory factory,
Executor writerExecutor) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
copyTo(SequentialFile newFileName) |
void |
delete() |
boolean |
exists() |
boolean |
fits(int size) |
protected File |
getFile() |
String |
getFileName() |
File |
getJavaFile()
Returns a native File of the file underlying this sequential file.
|
protected ByteBuffer |
newBuffer(int size,
int limit) |
long |
position() |
void |
position(long pos) |
void |
renameTo(String newFileName) |
void |
setTimedBuffer(TimedBuffer buffer) |
void |
write(ActiveMQBuffer bytes,
boolean sync) |
void |
write(ActiveMQBuffer bytes,
boolean sync,
IOCallback callback) |
void |
write(EncodingSupport bytes,
boolean sync) |
void |
write(EncodingSupport bytes,
boolean sync,
IOCallback callback) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcalculateBlockStart, cloneFile, fill, isOpen, open, open, read, read, size, sync, writeDirect, writeDirectprotected final File directory
protected final SequentialFileFactory factory
protected long fileSize
protected final AtomicLong position
protected TimedBuffer timedBuffer
protected final TimedBufferObserver timedBufferObserver
public AbstractSequentialFile(File directory, String file, SequentialFileFactory factory, Executor writerExecutor)
file - directory - public final boolean exists()
exists in interface SequentialFilepublic final String getFileName()
getFileName in interface SequentialFilepublic final void delete()
throws IOException,
InterruptedException,
ActiveMQException
delete in interface SequentialFileIOExceptionInterruptedExceptionActiveMQExceptionpublic void copyTo(SequentialFile newFileName) throws Exception
copyTo in interface SequentialFileExceptionpublic void position(long pos)
throws IOException
position in interface SequentialFileIOException - only declare exception due to signature. Sub-class needs it.public long position()
position in interface SequentialFilepublic final void renameTo(String newFileName) throws IOException, InterruptedException, ActiveMQException
renameTo in interface SequentialFileIOExceptionInterruptedExceptionActiveMQExceptionpublic void close()
throws IOException,
InterruptedException,
ActiveMQException
close in interface SequentialFileIOException - we declare throwing IOException because sub-classes need to do itActiveMQExceptionInterruptedExceptionpublic final boolean fits(int size)
fits in interface SequentialFilepublic void setTimedBuffer(TimedBuffer buffer)
setTimedBuffer in interface SequentialFilepublic void write(ActiveMQBuffer bytes, boolean sync, IOCallback callback) throws IOException
write in interface SequentialFileIOExceptionpublic void write(ActiveMQBuffer bytes, boolean sync) throws IOException, InterruptedException, ActiveMQException
write in interface SequentialFileIOExceptionInterruptedExceptionActiveMQExceptionpublic void write(EncodingSupport bytes, boolean sync, IOCallback callback)
write in interface SequentialFilepublic void write(EncodingSupport bytes, boolean sync) throws InterruptedException, ActiveMQException
write in interface SequentialFileInterruptedExceptionActiveMQExceptionprotected File getFile()
protected ByteBuffer newBuffer(int size, int limit)
public File getJavaFile()
SequentialFilegetJavaFile in interface SequentialFileCopyright © 2018 JBoss by Red Hat. All rights reserved.