Package org.apache.lucene.tests.mockfile
Class FilterAsynchronousFileChannel
- java.lang.Object
-
- java.nio.channels.AsynchronousFileChannel
-
- org.apache.lucene.tests.mockfile.FilterAsynchronousFileChannel
-
- All Implemented Interfaces:
Closeable,AutoCloseable,AsynchronousChannel,Channel
public class FilterAsynchronousFileChannel extends AsynchronousFileChannel
AFilterAsynchronousFileChannelcontains anotherAsynchronousFileChannel, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.
-
-
Field Summary
Fields Modifier and Type Field Description protected AsynchronousFileChanneldelegateThe underlyingAsynchronousFileChannelinstance.
-
Constructor Summary
Constructors Constructor Description FilterAsynchronousFileChannel(AsynchronousFileChannel delegate)Construct aFilterAsynchronousFileChannelbased on the specified base channel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidforce(boolean metaData)booleanisOpen()Future<FileLock>lock(long position, long size, boolean shared)<A> voidlock(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock,? super A> handler)Future<Integer>read(ByteBuffer dst, long position)<A> voidread(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer,? super A> handler)longsize()AsynchronousFileChanneltruncate(long size)FileLocktryLock(long position, long size, boolean shared)Future<Integer>write(ByteBuffer src, long position)<A> voidwrite(ByteBuffer src, long position, A attachment, CompletionHandler<Integer,? super A> handler)
-
-
-
Field Detail
-
delegate
protected final AsynchronousFileChannel delegate
The underlyingAsynchronousFileChannelinstance.
-
-
Constructor Detail
-
FilterAsynchronousFileChannel
public FilterAsynchronousFileChannel(AsynchronousFileChannel delegate)
Construct aFilterAsynchronousFileChannelbased on the specified base channel.Note that base channel is closed if this channel is closed.
- Parameters:
delegate- specified base channel.
-
-
Method Detail
-
close
public void close() throws IOException- Throws:
IOException
-
isOpen
public boolean isOpen()
-
size
public long size() throws IOException- Specified by:
sizein classAsynchronousFileChannel- Throws:
IOException
-
truncate
public AsynchronousFileChannel truncate(long size) throws IOException
- Specified by:
truncatein classAsynchronousFileChannel- Throws:
IOException
-
force
public void force(boolean metaData) throws IOException- Specified by:
forcein classAsynchronousFileChannel- Throws:
IOException
-
lock
public <A> void lock(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock,? super A> handler)- Specified by:
lockin classAsynchronousFileChannel
-
lock
public Future<FileLock> lock(long position, long size, boolean shared)
- Specified by:
lockin classAsynchronousFileChannel
-
tryLock
public FileLock tryLock(long position, long size, boolean shared) throws IOException
- Specified by:
tryLockin classAsynchronousFileChannel- Throws:
IOException
-
read
public <A> void read(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer,? super A> handler)
- Specified by:
readin classAsynchronousFileChannel
-
read
public Future<Integer> read(ByteBuffer dst, long position)
- Specified by:
readin classAsynchronousFileChannel
-
write
public <A> void write(ByteBuffer src, long position, A attachment, CompletionHandler<Integer,? super A> handler)
- Specified by:
writein classAsynchronousFileChannel
-
write
public Future<Integer> write(ByteBuffer src, long position)
- Specified by:
writein classAsynchronousFileChannel
-
-