@NotThreadSafe @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public class SeekableByteBufferChannel extends Object implements SeekableByteChannel
| Modifier and Type | Field and Description |
|---|---|
private ByteBuffer |
buffer |
| Constructor and Description |
|---|
SeekableByteBufferChannel(ByteBuffer buffer)
Constructs a new seekable byte buffer channel with a
duplicate of the given byte buffer as
its initial byte buffer. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
A no-op.
|
private void |
ensureLimit(long minLimit) |
ByteBuffer |
getByteBuffer()
Returns a
duplicate of the backing byte
buffer. |
boolean |
isOpen()
Returns
true. |
long |
position() |
SeekableByteBufferChannel |
position(long newPosition) |
int |
read(ByteBuffer dst) |
long |
size() |
SeekableByteBufferChannel |
truncate(long newSize) |
int |
write(ByteBuffer src) |
private ByteBuffer buffer
public SeekableByteBufferChannel(ByteBuffer buffer)
duplicate of the given byte buffer as
its initial byte buffer.
Note that the buffer contents are shared between the client application
and this class.buffer - the initial byte buffer to read or write.IllegalArgumentException - if buffer supports no
array access for copying data using
relative bulk get
and put methods.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface ChannelIOExceptionprivate void ensureLimit(long minLimit)
public ByteBuffer getByteBuffer()
duplicate of the backing byte
buffer.
Note that the buffer contents are shared between the client application
and this class.duplicate of the backing byte
buffer.public boolean isOpen()
true.public final long position()
position in interface SeekableByteChannelpublic final SeekableByteBufferChannel position(long newPosition)
position in interface SeekableByteChannelpublic final int read(ByteBuffer dst)
read in interface ReadableByteChannelread in interface SeekableByteChannelpublic final long size()
size in interface SeekableByteChannelpublic final SeekableByteBufferChannel truncate(long newSize)
truncate in interface SeekableByteChannelpublic final int write(ByteBuffer src)
write in interface SeekableByteChannelwrite in interface WritableByteChannelCopyright © 2004-2011 Schlichtherle IT Services. All Rights Reserved.