public class IfxCsmBuffer
extends java.io.ByteArrayOutputStream
| Constructor and Description |
|---|
IfxCsmBuffer() |
IfxCsmBuffer(int initSize) |
| Modifier and Type | Method and Description |
|---|---|
int |
getCount() |
void |
initialize(IfxCsmBuffer anotherBuffer)
this shall initialize this csmBuffer with contents ( i.e.
|
void |
initialize(IfxCsmReadBuffer bis)
populates buf reference with internal buffer reference from
bis
Be aware that this method does not care about the current
position (pos) of bis
|
int |
read(byte[] b,
int off,
int len)
copies len number fo bytes from byte array buf
into byte array b
***************IMPORTANT ****************************
Note that this read does not behave like read on an input stream
if you read say n bytes and then again call read to ream next m bytes
you are going to get n as well as m from begining of buf
thus you shall end up getting first m bytes from array and
NOT m bytes from position buf[n]
|
byte[] |
read(int len)
Allocates a byte array , copies len bytes from byte array buf to it
and returns the array
|
int |
readWithReset(byte[] b,
int off,
int len)
This functions reads bytes from byte array buf
creates a new byte array
copies unread bytes from buf to new byte array
replaces byte array referred to by buf with this new array
Also resets count .
|
byte[] |
readWithReset(int len) |
void |
reset()
we are overriding default implementation of reset() in ByteArrayOutputStream
The default implementation does not release the internal buffer 'buf'
but just resets count to zero.
|
void |
resetAndwrite(byte[] b) |
byte[] |
toByteArray() |
byte[] |
toByteArrayWithReset() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeTo(java.io.OutputStream out) |
public IfxCsmBuffer()
public IfxCsmBuffer(int initSize)
public void initialize(IfxCsmBuffer anotherBuffer)
anotherBuffer - used to initialize this buffer
Note that anotherBuffer IS RESETpublic void initialize(IfxCsmReadBuffer bis)
bis - public void write(byte[] b,
int off,
int len)
write in class java.io.ByteArrayOutputStreampublic void write(byte[] b)
write in class java.io.OutputStreampublic void resetAndwrite(byte[] b)
public void write(int b)
write in class java.io.ByteArrayOutputStreampublic byte[] toByteArray()
toByteArray in class java.io.ByteArrayOutputStreampublic byte[] toByteArrayWithReset()
public int read(byte[] b,
int off,
int len)
b - off - len - public byte[] read(int len)
len - public byte[] readWithReset(int len)
public int readWithReset(byte[] b,
int off,
int len)
b - off - len - public int getCount()
public void reset()
reset in class java.io.ByteArrayOutputStreampublic void writeTo(java.io.OutputStream out)
throws java.io.IOException
writeTo in class java.io.ByteArrayOutputStreamjava.io.IOException