|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vostok.io.ByteBuffer
public class ByteBuffer
ByteBuffer is an array of byte than can grow
Field Summary | |
---|---|
static int |
HUGE
|
static int |
INSANE
|
static int |
MEDIUM
|
static int |
TINY
|
Constructor Summary | |
---|---|
ByteBuffer()
create a new ByteBuffer with a default growby of 1024 |
|
ByteBuffer(int growby)
create a new ByteBuffer with a specific growing policy. use constant ou specify your own size (byte). bigger growby is, faster the buffer is but bigger the memory use is too. |
Method Summary | |
---|---|
byte[] |
copy()
return a newly allocated copy of the available data |
byte[] |
get()
return a pointer on the current buffer. keep in mind that get().size ! |
int |
getMaxSize()
return the maximum data this buffer can (currently) hold without resizing |
int |
getSize()
return the data size. this is the actual size, keep in mind that get().size ! |
void |
push(byte b)
push a byte on top of the buffer, increase buffer size if require |
void |
push(byte[] b)
push bytes on top of the buffer, increase buffer size if require |
void |
push(byte[] b,
int length)
push bytes - up to size - on top of the buffer, increase buffer size if require |
void |
push(java.io.InputStream stream,
int length)
append data from stream, up to length byet to the Byte Buffer |
void |
truncate(int length)
truncate data to size. |
static ByteBuffer |
wrap(java.io.InputStream stream,
int length)
wrap an input stream into a ByteBuffer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TINY
public static final int MEDIUM
public static final int HUGE
public static final int INSANE
Constructor Detail |
---|
public ByteBuffer()
public ByteBuffer(int growby)
growby
- Method Detail |
---|
public static ByteBuffer wrap(java.io.InputStream stream, int length) throws java.io.IOException
stream
- an input stream to load data from. buffer will start at the current stream position an up to size bytelength
- maximun bytes to read. if set to -1, no limit
java.io.IOException
public void push(byte b)
b
- public void push(byte[] b)
b
- public void push(byte[] b, int length)
b
- public void push(java.io.InputStream stream, int length) throws java.io.IOException
stream
- an input stream to load data from. buffer will start at the current stream position an up to size bytelength
- maximun bytes to read. if set to -1, no limit
java.io.IOException
public byte[] copy()
public byte[] get()
public void truncate(int length)
public int getSize()
public int getMaxSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |