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 ChannelChannel.isOpen()public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface ChannelIOExceptionChannel.close()public int read(ByteBuffer destination) throws IOException
read in interface ReadableByteChannelread in interface SeekableByteChannelIOExceptionSeekableByteChannel.read(java.nio.ByteBuffer)public int write(ByteBuffer source) throws IOException
write in interface SeekableByteChannelwrite in interface WritableByteChannelIOExceptionSeekableByteChannel.write(java.nio.ByteBuffer)public long position()
throws IOException
position in interface SeekableByteChannelIOExceptionSeekableByteChannel.position()public SeekableByteChannel position(long newPosition) throws IOException
position in interface SeekableByteChannelIOExceptionSeekableByteChannel.position(long)public long size()
throws IOException
size in interface SeekableByteChannelIOExceptionSeekableByteChannel.size()public SeekableByteChannel truncate(long size) throws IOException
truncate in interface SeekableByteChannelIOExceptionSeekableByteChannel.truncate(long)Copyright © 2013 JBoss by Red Hat. All Rights Reserved.