Constructor and Description |
---|
MemoryStream()
Create a new memory stream with initial capacity 0 and block size 8192 Bytes
|
MemoryStream(byte[] buffer,
int offset,
int length)
Create a new memory stream with block size 8192 by copying from a buffer
|
MemoryStream(byte[] buffer,
int offset,
int length,
int blockSize)
Create a new memory stream by copying from a buffer
|
MemoryStream(long initialCapacity)
Create a new memory stream with block size 8192 Bytes
|
MemoryStream(long initialCapacity,
int blockSize)
Create a new memory stream
|
MemoryStream(Stream stream)
Create a new memory with block size 8192 stream by copying a stream
|
MemoryStream(Stream stream,
int blockSize)
Create a new memory stream by copying a stream
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getLength()
Get the length of the stream in bytes
|
int |
read(byte[] buffer,
int offset,
int length)
Read from the stream
|
boolean |
seek(long position)
Set byte position
|
long |
tell()
Get current byte position
|
void |
write(byte[] buffer,
int offset,
int length)
Write to the stream
|
public MemoryStream(long initialCapacity, int blockSize)
initialCapacity
- The initial capacity of the stream. The length of the stream is still 0blockSize
- The size of the memory blocks used to store the datapublic MemoryStream(long initialCapacity)
initialCapacity
- The initial capacity of the stream. The length of the stream is still 0public MemoryStream()
public MemoryStream(byte[] buffer, int offset, int length, int blockSize)
buffer
- The buffer from which the initial data is copiedoffset
- The offset where the first byte from the buffer is copiedlength
- The number of bytes that are copied from the bufferblockSize
- The size of the memory blocks used to store the datapublic MemoryStream(byte[] buffer, int offset, int length)
buffer
- The buffer from which the initial data is copiedoffset
- The offset where the first byte from the buffer is copiedlength
- The number of bytes that are copied from the bufferpublic MemoryStream(Stream stream, int blockSize) throws java.io.IOException
stream
- The stream from which the initial data is copiedblockSize
- The size of the memory blocks used to store the datajava.io.IOException
public MemoryStream(Stream stream) throws java.io.IOException
stream
- The stream from which the initial data is copiedjava.io.IOException
public long getLength()
public boolean seek(long position)
public long tell()
public int read(byte[] buffer, int offset, int length)
public void write(byte[] buffer, int offset, int length)