public class SeekableInMemoryByteChannel extends Object implements SeekableByteChannel
SeekableByteChannel
implementation backed by an auto-resizing byte array; thread-safe. Can hold a maxiumum of
Integer.MAX_VALUE
bytes.Constructor and Description |
---|
SeekableInMemoryByteChannel()
Creates a new instance with 0 size and 0 position, and open.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
isOpen() |
long |
position() |
SeekableByteChannel |
position(long newPosition) |
int |
read(ByteBuffer destination) |
long |
size() |
SeekableByteChannel |
truncate(long size) |
int |
write(ByteBuffer source) |
public SeekableInMemoryByteChannel()
public boolean isOpen()
isOpen
in interface Channel
Channel.isOpen()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
IOException
Channel.close()
public int read(ByteBuffer destination) throws IOException
read
in interface ReadableByteChannel
read
in interface SeekableByteChannel
IOException
SeekableByteChannel.read(java.nio.ByteBuffer)
public int write(ByteBuffer source) throws IOException
write
in interface SeekableByteChannel
write
in interface WritableByteChannel
IOException
SeekableByteChannel.write(java.nio.ByteBuffer)
public long position() throws IOException
position
in interface SeekableByteChannel
IOException
SeekableByteChannel.position()
public SeekableByteChannel position(long newPosition) throws IOException
position
in interface SeekableByteChannel
IOException
SeekableByteChannel.position(long)
public long size() throws IOException
size
in interface SeekableByteChannel
IOException
SeekableByteChannel.size()
public SeekableByteChannel truncate(long size) throws IOException
truncate
in interface SeekableByteChannel
IOException
SeekableByteChannel.truncate(long)
Copyright © 2016 JBoss by Red Hat. All rights reserved.