@NotThreadSafe @CleanupObligation public class SeekableByteBufferChannel extends Object implements SeekableByteChannel
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.
|
ByteBuffer |
getByteBuffer()
Returns a duplicate of the backing
byte buffer.
|
boolean |
isOpen()
Returns always
true . |
long |
position() |
SeekableByteBufferChannel |
position(long newPosition) |
int |
read(ByteBuffer dst) |
long |
size() |
SeekableByteBufferChannel |
truncate(long size) |
int |
write(ByteBuffer src) |
@CreatesObligation public SeekableByteBufferChannel(ByteBuffer buffer)
buffer
- the initial byte buffer to read or write.@DischargesObligation public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
IOException
public ByteBuffer getByteBuffer()
public boolean isOpen()
true
.public final long position() throws IOException
position
in interface SeekableByteChannel
IOException
public final SeekableByteBufferChannel position(long newPosition) throws IOException
position
in interface SeekableByteChannel
IOException
public final int read(ByteBuffer dst) throws IOException
read
in interface ReadableByteChannel
read
in interface SeekableByteChannel
IOException
public final long size() throws IOException
size
in interface SeekableByteChannel
IOException
public final SeekableByteBufferChannel truncate(long size) throws IOException
truncate
in interface SeekableByteChannel
IOException
public final int write(ByteBuffer src) throws IOException
write
in interface SeekableByteChannel
write
in interface WritableByteChannel
IOException
Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.