public class ByteArraySeekableChannel
extends java.lang.Object
implements java.nio.channels.SeekableByteChannel
SeekableByteChannel implementation, similar to
ByteArrayOutputStream which manages a growable buffer.
Created by covers1624 on 14/3/24.
| Constructor and Description |
|---|
ByteArraySeekableChannel() |
ByteArraySeekableChannel(int size) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
isOpen() |
long |
position() |
java.nio.channels.SeekableByteChannel |
position(long newPosition) |
int |
read(java.nio.ByteBuffer dst) |
long |
size() |
java.nio.channels.SeekableByteChannel |
truncate(long size) |
int |
write(java.nio.ByteBuffer src) |
public ByteArraySeekableChannel()
public ByteArraySeekableChannel(int size)
public int read(java.nio.ByteBuffer dst)
read in interface java.nio.channels.ReadableByteChannelread in interface java.nio.channels.SeekableByteChannelpublic int write(java.nio.ByteBuffer src)
write in interface java.nio.channels.SeekableByteChannelwrite in interface java.nio.channels.WritableByteChannelpublic long position()
position in interface java.nio.channels.SeekableByteChannelpublic java.nio.channels.SeekableByteChannel position(long newPosition)
position in interface java.nio.channels.SeekableByteChannelpublic long size()
throws java.io.IOException
size in interface java.nio.channels.SeekableByteChanneljava.io.IOExceptionpublic java.nio.channels.SeekableByteChannel truncate(long size)
truncate in interface java.nio.channels.SeekableByteChannelpublic boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channel