public class ByteBufferSeekableSource extends java.lang.Object implements SeekableSource
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
bb |
private java.nio.ByteBuffer |
cur |
Constructor and Description |
---|
ByteBufferSeekableSource(byte[] source)
Constructs a new ByteArraySeekableSource.
|
ByteBufferSeekableSource(java.nio.ByteBuffer bb)
Constructs a new ByteArraySeekableSource.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
read(java.nio.ByteBuffer dest)
Reads up to
Buffer.remaining() bytes from the source,
returning the number of bytes read, or -1 if no bytes were read
and EOF was reached. |
void |
seek(long pos)
Sets the position for the next
SeekableSource.read(ByteBuffer) . |
java.lang.String |
toString()
Returns a debug
String . |
public ByteBufferSeekableSource(byte[] source)
public ByteBufferSeekableSource(java.nio.ByteBuffer bb)
public void seek(long pos) throws java.io.IOException
SeekableSource
SeekableSource.read(ByteBuffer)
.seek
in interface SeekableSource
java.io.IOException
public int read(java.nio.ByteBuffer dest) throws java.io.IOException
SeekableSource
Buffer.remaining()
bytes from the source,
returning the number of bytes read, or -1 if no bytes were read
and EOF was reached.read
in interface SeekableSource
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public java.lang.String toString()
String
.toString
in class java.lang.Object