@NotThreadSafe
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public class SeekableByteBufferChannel
extends java.lang.Object
implements java.nio.channels.SeekableByteChannel
| Modifier and Type | Field and Description |
|---|---|
private java.nio.ByteBuffer |
buffer |
| Constructor and Description |
|---|
SeekableByteBufferChannel(java.nio.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) |
java.nio.ByteBuffer |
getByteBuffer()
Returns a
duplicate of the backing byte
buffer. |
boolean |
isOpen()
Returns
true. |
long |
position() |
SeekableByteBufferChannel |
position(long newPosition) |
int |
read(java.nio.ByteBuffer dst) |
long |
size() |
SeekableByteBufferChannel |
truncate(long newSize) |
int |
write(java.nio.ByteBuffer src) |
public SeekableByteBufferChannel(java.nio.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.java.lang.IllegalArgumentException - if buffer supports no
array access for copying data using
relative bulk get
and put methods.public java.nio.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 final int read(java.nio.ByteBuffer dst)
read in interface java.nio.channels.ReadableByteChannelread in interface java.nio.channels.SeekableByteChannelpublic final int write(java.nio.ByteBuffer src)
write in interface java.nio.channels.SeekableByteChannelwrite in interface java.nio.channels.WritableByteChannelpublic final long position()
position in interface java.nio.channels.SeekableByteChannelprivate void ensureLimit(long minLimit)
public final SeekableByteBufferChannel position(long newPosition)
position in interface java.nio.channels.SeekableByteChannelpublic final long size()
size in interface java.nio.channels.SeekableByteChannelpublic final SeekableByteBufferChannel truncate(long newSize)
truncate in interface java.nio.channels.SeekableByteChannelpublic boolean isOpen()
true.isOpen in interface java.nio.channels.Channeltrue.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channeljava.io.IOExceptionCopyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.