Package org.apache.lucene.tests.mockfile
Class FilterSeekableByteChannel
- java.lang.Object
-
- org.apache.lucene.tests.mockfile.FilterSeekableByteChannel
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ByteChannel
,Channel
,ReadableByteChannel
,SeekableByteChannel
,WritableByteChannel
public class FilterSeekableByteChannel extends Object implements SeekableByteChannel
AFilterSeekableByteChannel
contains anotherSeekableByteChannel
, 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 SeekableByteChannel
delegate
The underlyingSeekableByteChannel
instance.
-
Constructor Summary
Constructors Constructor Description FilterSeekableByteChannel(SeekableByteChannel delegate)
Construct aFilterSeekableByteChannel
based on the specified base channel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
isOpen()
long
position()
SeekableByteChannel
position(long newPosition)
int
read(ByteBuffer dst)
long
size()
SeekableByteChannel
truncate(long size)
int
write(ByteBuffer src)
-
-
-
Field Detail
-
delegate
protected final SeekableByteChannel delegate
The underlyingSeekableByteChannel
instance.
-
-
Constructor Detail
-
FilterSeekableByteChannel
public FilterSeekableByteChannel(SeekableByteChannel delegate)
Construct aFilterSeekableByteChannel
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
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
read
public int read(ByteBuffer dst) throws IOException
- Specified by:
read
in interfaceReadableByteChannel
- Specified by:
read
in interfaceSeekableByteChannel
- Throws:
IOException
-
write
public int write(ByteBuffer src) throws IOException
- Specified by:
write
in interfaceSeekableByteChannel
- Specified by:
write
in interfaceWritableByteChannel
- Throws:
IOException
-
position
public long position() throws IOException
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
position
public SeekableByteChannel position(long newPosition) throws IOException
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
size
public long size() throws IOException
- Specified by:
size
in interfaceSeekableByteChannel
- Throws:
IOException
-
truncate
public SeekableByteChannel truncate(long size) throws IOException
- Specified by:
truncate
in interfaceSeekableByteChannel
- Throws:
IOException
-
-