|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.infinispan.io.MarshalledValueByteStream
org.infinispan.io.ExpandableMarshalledValueByteStream
public class ExpandableMarshalledValueByteStream
A byte stream that can be written to and expanded on the fly, not dissimilar to ExposedByteArrayOutputStream
but with the benefit of not having to allocate unnecessary byte arrays byt not extending ByteArrayOutputStream
.
Field Summary | |
---|---|
static int |
DEFAULT_DOUBLING_SIZE
Default buffer size after which if more buffer capacity is needed the buffer will grow by 25% rather than 100% |
Constructor Summary | |
---|---|
ExpandableMarshalledValueByteStream()
|
|
ExpandableMarshalledValueByteStream(int size)
|
|
ExpandableMarshalledValueByteStream(int size,
int maxDoublingSize)
Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes. |
Method Summary | |
---|---|
boolean |
equals(Object thatObject)
|
int |
getMaxDoublingSize()
Gets the highest internal buffer size after which if more capacity is needed the buffer will grow in 25% increments rather than 100%. |
int |
getNewBufferSize(int curSize,
int minNewSize)
Gets the number of bytes to which the internal buffer should be resized. |
byte[] |
getRaw()
Gets the internal buffer array. |
void |
set(byte[] b)
|
int |
size()
Overriden only to avoid unneeded synchronization |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.io.OutputStream |
---|
close, flush, write |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_DOUBLING_SIZE
Constructor Detail |
---|
public ExpandableMarshalledValueByteStream()
public ExpandableMarshalledValueByteStream(int size)
public ExpandableMarshalledValueByteStream(int size, int maxDoublingSize)
size
- the initial size.maxDoublingSize
- the buffer size, after which if more capacity is needed the buffer will grow by 25% rather
than 100%
IllegalArgumentException
- if size is negative.Method Detail |
---|
public final byte[] getRaw()
size()
to get the number of bytes of actual data.
getRaw
in class MarshalledValueByteStream
public final void set(byte[] b)
public final void write(byte[] b, int off, int len)
write
in class OutputStream
public final void write(int b)
write
in class OutputStream
public final int getMaxDoublingSize()
public final int getNewBufferSize(int curSize, int minNewSize)
curSize
- the current number of bytesminNewSize
- the minimum number of bytes required
public final int size()
size
in class MarshalledValueByteStream
public boolean equals(Object thatObject)
equals
in class Object
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |