public final class ExpandableMarshalledValueByteStream extends MarshalledValueByteStream
ExposedByteArrayOutputStream
but with the benefit of not having to allocate unnecessary byte arrays by not extending ByteArrayOutputStream.| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
int |
hashCode() |
int |
size()
Overriden only to avoid unneeded synchronization
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public static final int DEFAULT_DOUBLING_SIZE
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.public final byte[] getRaw()
size() to get the number of bytes of actual data.getRaw in class MarshalledValueByteStreampublic final void write(byte[] b,
int off,
int len)
write in class OutputStreampublic final void write(int b)
write in class OutputStreampublic final int getMaxDoublingSize()
public final int getNewBufferSize(int curSize,
int minNewSize)
curSize - the current number of bytesminNewSize - the minimum number of bytes requiredpublic final int size()
size in class MarshalledValueByteStreamCopyright © 2015 JBoss, a division of Red Hat. All rights reserved.