Package com.pnfsoftware.jeb.util.io
Class SubSeekableByteChannel
java.lang.Object
com.pnfsoftware.jeb.util.io.SubSeekableByteChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,ReadableByteChannel,SeekableByteChannel,WritableByteChannel
An seekable channel presenting a region of another seekable channel. Only read-operations are
supported. Attempts to write or modify the master channel will raise an
IOException.-
Constructor Summary
ConstructorsConstructorDescriptionSubSeekableByteChannel(SeekableByteChannel channel, long base, long maxsize) Create a sub channel. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this sub-channel and its master channel.booleanisOpen()longposition()position(long newPosition) intread(ByteBuffer dst) longsize()truncate(long size) intwrite(ByteBuffer src)
-
Constructor Details
-
SubSeekableByteChannel
public SubSeekableByteChannel(SeekableByteChannel channel, long base, long maxsize) throws IOException Create a sub channel.- Parameters:
channel- the main channelbase- beginning of regionmaxsize- size of region- Throws:
IOException
-
-
Method Details
-
isOpen
public boolean isOpen() -
close
Close this sub-channel and its master channel.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
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
-