public class MemoryStream extends Stream implements java.lang.AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
protected int |
cursor |
protected byte[] |
data |
protected int |
size |
SEEK_CURRENT, SEEK_END, SEEK_SET| Constructor and Description |
|---|
MemoryStream() |
MemoryStream(byte[] data) |
MemoryStream(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
copyTo(java.io.OutputStream stream) |
void |
copyTo(Stream stream) |
void |
flush() |
byte[] |
getBuffer() |
long |
getLength() |
int |
getSize() |
int |
read(byte[] buf) |
int |
read(byte[] buf,
int start,
int len) |
int |
readByte() |
long |
seek(long offset,
int seek) |
void |
setCapacity(int cap)
Sets the capacity to specified value
|
void |
setLength(long len) |
byte[] |
toArray() |
void |
write(byte[] buf) |
void |
write(byte[] buf,
int start,
int len) |
void |
writeByte(int b) |
getInputStream, getOutputStream, read, wrap, wrap, writepublic MemoryStream()
public MemoryStream(int capacity)
public MemoryStream(byte[] data)
public int getSize()
public byte[] getBuffer()
public void setCapacity(int cap)
cap - new capacity of the memory stream.public void flush()
throws java.io.IOException
public int readByte()
throws java.io.IOException
public int read(byte[] buf)
throws java.io.IOException
public int read(byte[] buf,
int start,
int len)
throws java.io.IOException
public void write(byte[] buf)
throws java.io.IOException
public void write(byte[] buf,
int start,
int len)
throws java.io.IOException
public void writeByte(int b)
throws java.io.IOException
public long seek(long offset,
int seek)
throws java.io.IOException
public byte[] toArray()
public void close()
throws java.io.IOException
public void copyTo(Stream stream) throws java.io.IOException
public void copyTo(java.io.OutputStream stream)
throws java.io.IOException
java.io.IOException