public class SeekableInMemoryByteChannel extends Object implements SeekableByteChannel
SeekableByteChannel implementation backed by an auto-resizing byte array; thread-safe. Can hold a maximum 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() |
InputStream |
getContents()
Obtain a copy of the contents of this
Channel as an InputStream |
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()
close in interface Closeableclose in interface AutoCloseableclose in interface ChannelChannel.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()
position in interface SeekableByteChannelSeekableByteChannel.position()public SeekableByteChannel position(long newPosition)
position in interface SeekableByteChannelSeekableByteChannel.position(long)public long size()
size in interface SeekableByteChannelSeekableByteChannel.size()public SeekableByteChannel truncate(long size)
truncate in interface SeekableByteChannelSeekableByteChannel.truncate(long)public InputStream getContents()
Channel as an InputStreamCopyright © 2024 JBoss by Red Hat. All rights reserved.