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
AFilterAsynchronousFileChannel
contains 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 AsynchronousFileChannel
delegate
The underlyingAsynchronousFileChannel
instance.
-
Constructor Summary
Constructors Constructor Description FilterAsynchronousFileChannel(AsynchronousFileChannel delegate)
Construct aFilterAsynchronousFileChannel
based on the specified base channel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
force(boolean metaData)
boolean
isOpen()
Future<FileLock>
lock(long position, long size, boolean shared)
<A> void
lock(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock,? super A> handler)
Future<Integer>
read(ByteBuffer dst, long position)
<A> void
read(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer,? super A> handler)
long
size()
AsynchronousFileChannel
truncate(long size)
FileLock
tryLock(long position, long size, boolean shared)
Future<Integer>
write(ByteBuffer src, long position)
<A> void
write(ByteBuffer src, long position, A attachment, CompletionHandler<Integer,? super A> handler)
-
-
-
Field Detail
-
delegate
protected final AsynchronousFileChannel delegate
The underlyingAsynchronousFileChannel
instance.
-
-
Constructor Detail
-
FilterAsynchronousFileChannel
public FilterAsynchronousFileChannel(AsynchronousFileChannel delegate)
Construct aFilterAsynchronousFileChannel
based 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:
size
in classAsynchronousFileChannel
- Throws:
IOException
-
truncate
public AsynchronousFileChannel truncate(long size) throws IOException
- Specified by:
truncate
in classAsynchronousFileChannel
- Throws:
IOException
-
force
public void force(boolean metaData) throws IOException
- Specified by:
force
in classAsynchronousFileChannel
- Throws:
IOException
-
lock
public <A> void lock(long position, long size, boolean shared, A attachment, CompletionHandler<FileLock,? super A> handler)
- Specified by:
lock
in classAsynchronousFileChannel
-
lock
public Future<FileLock> lock(long position, long size, boolean shared)
- Specified by:
lock
in classAsynchronousFileChannel
-
tryLock
public FileLock tryLock(long position, long size, boolean shared) throws IOException
- Specified by:
tryLock
in classAsynchronousFileChannel
- Throws:
IOException
-
read
public <A> void read(ByteBuffer dst, long position, A attachment, CompletionHandler<Integer,? super A> handler)
- Specified by:
read
in classAsynchronousFileChannel
-
read
public Future<Integer> read(ByteBuffer dst, long position)
- Specified by:
read
in classAsynchronousFileChannel
-
write
public <A> void write(ByteBuffer src, long position, A attachment, CompletionHandler<Integer,? super A> handler)
- Specified by:
write
in classAsynchronousFileChannel
-
write
public Future<Integer> write(ByteBuffer src, long position)
- Specified by:
write
in classAsynchronousFileChannel
-
-