|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.ByteArrayOutputStream
lbg.common.io.EnhancedByteArrayOutputStream
public class EnhancedByteArrayOutputStream
Additional methods for the standard ByteArrayOutputStream. This new class allows to copy its buffer in an already allocated byte array rather than creating a new one and can support a limit of characters.
If the stream is not large enough to fit the given information, it is silently dropped. This is useful in cases where you need to start a trustless child thread than should only output a limited amount of data.
Field Summary |
---|
Fields inherited from class java.io.ByteArrayOutputStream |
---|
buf, count |
Constructor Summary | |
---|---|
EnhancedByteArrayOutputStream()
|
|
EnhancedByteArrayOutputStream(int limit)
|
|
EnhancedByteArrayOutputStream(int limit,
int size)
|
Method Summary | |
---|---|
int |
setLimit(int new_limit)
Sets the limit size for this stream to a new value. |
byte[] |
toByteArray(byte[] array)
Copies the buffer of this stream to the given byte array. |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.io.ByteArrayOutputStream |
---|
close, reset, size, toByteArray, toString, toString, toString, writeTo |
Methods inherited from class java.io.OutputStream |
---|
flush, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EnhancedByteArrayOutputStream()
public EnhancedByteArrayOutputStream(int limit)
public EnhancedByteArrayOutputStream(int limit, int size)
Method Detail |
---|
public int setLimit(int new_limit)
new_limit
- The new byte limit
public byte[] toByteArray(byte[] array)
ByteArrayOutputStream.toByteArray()
.
array
- The array where data should be put.
public void write(byte[] b, int off, int len)
If the contents don't fit in the stream because of the limit, it is truncated.
write
in class java.io.ByteArrayOutputStream
public void write(int b)
If the content don't fit in the stream because of limit, it is dropped.
write
in class java.io.ByteArrayOutputStream
|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.