| Modifier and Type | Field and Description |
|---|---|
| private static final int | BEST_GUESS_SIZE
byte[] payloads are not expected to be tiny. |
| private static int |
| Access | Constructor and Description |
|---|---|
| public | MemoryEfficientByteArrayOutputStream(int
the initial size. size)Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes. |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized byte[] | |
| public static MemoryEfficientByteArrayOutputStream | Returns: a ByteArrayOutputStream with a Serialized object in itany Object that implements Serializable serializable, int how many bytes is expected to be in the Serialized representation estimatedPayloadSize)Factory method |
| public static MemoryEfficientByteArrayOutputStream | Returns: a ByteArrayOutputStream with a Serialized object in itany Object that implements Serializable serializable)Factory method. |
| BEST_GUESS_SIZE | back to summary |
|---|---|
| private static final int BEST_GUESS_SIZE byte[] payloads are not expected to be tiny. | |
| lastSize | back to summary |
|---|---|
| private static int lastSize | |
| MemoryEfficientByteArrayOutputStream | back to summary |
|---|---|
| public MemoryEfficientByteArrayOutputStream(int size) Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.
| |
| getBytes | back to summary |
|---|---|
| public synchronized byte[] getBytes() Gets the bytes.
| |
| serialize | back to summary |
|---|---|
| public static MemoryEfficientByteArrayOutputStream serialize(Serializable serializable, int estimatedPayloadSize) throws IOException Factory method
| |
| serialize | back to summary |
|---|---|
| public static MemoryEfficientByteArrayOutputStream serialize(Serializable serializable) throws IOException Factory method. This method optimises memory by trying to make a better guess than the Java default of 32 bytes by assuming the starting point for the serialized size will be what it was last time this method was called.
| |