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 TypeMethodDescriptionvoidclose()static SeekableByteChannelcreate(SeekableByteChannel in_channel, long in_lower, long in_upper, boolean in_allow_close) Create a new restricted seekable byte channel.booleanisOpen()longposition()position(long new_position) intread(ByteBuffer dst) longsize()truncate(long size) intwrite(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-trueif closing this channel closes the underlying channel- Returns:
- A new channel
-
read
- Specified by:
readin interfaceReadableByteChannel- Specified by:
readin interfaceSeekableByteChannel- Throws:
IOException
-
write
- Specified by:
writein interfaceSeekableByteChannel- Specified by:
writein interfaceWritableByteChannel- Throws:
IOException
-
position
- Specified by:
positionin interfaceSeekableByteChannel- Throws:
IOException
-
position
- Specified by:
positionin interfaceSeekableByteChannel- Throws:
IOException
-
size
- Specified by:
sizein interfaceSeekableByteChannel- Throws:
IOException
-
truncate
- Specified by:
truncatein interfaceSeekableByteChannel- Throws:
IOException
-
isOpen
public boolean isOpen() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-