Package com.io7m.jspiel.vanilla
Class RiffRestrictedSeekableByteChannel
java.lang.Object
com.io7m.jspiel.vanilla.RiffRestrictedSeekableByteChannel
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ByteChannel
,Channel
,ReadableByteChannel
,SeekableByteChannel
,WritableByteChannel
A byte channel that can only access a specified range of a given underlying channel.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static SeekableByteChannel
create
(SeekableByteChannel in_channel, long in_lower, long in_upper, boolean in_allow_close) Create a new restricted seekable byte channel.boolean
isOpen()
long
position()
position
(long new_position) int
read
(ByteBuffer dst) long
size()
truncate
(long size) int
write
(ByteBuffer src)
-
Method Details
-
create
public static SeekableByteChannel create(SeekableByteChannel in_channel, long in_lower, long in_upper, boolean in_allow_close) Create a new restricted seekable byte channel.- Parameters:
in_channel
- The underlying byte channelin_lower
- The lower bound of the accessible rangein_upper
- The upper bound of the accessible rangein_allow_close
-true
if closing this channel closes the underlying channel- Returns:
- A new channel
-
read
- Specified by:
read
in interfaceReadableByteChannel
- Specified by:
read
in interfaceSeekableByteChannel
- Throws:
IOException
-
write
- Specified by:
write
in interfaceSeekableByteChannel
- Specified by:
write
in interfaceWritableByteChannel
- Throws:
IOException
-
position
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
position
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
size
- Specified by:
size
in interfaceSeekableByteChannel
- Throws:
IOException
-
truncate
- Specified by:
truncate
in interfaceSeekableByteChannel
- Throws:
IOException
-
isOpen
public boolean isOpen() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-