Enlarges this byte vector so that it can receive 'size' more bytes. @param size number of additional bytes that this byte vector should be able to receive.
(final int size)
| 351 | * @param size number of additional bytes that this byte vector should be able to receive. |
| 352 | */ |
| 353 | private void enlarge(final int size) { |
| 354 | int doubleCapacity = 2 * data.length; |
| 355 | int minimalCapacity = length + size; |
| 356 | byte[] newData = new byte[doubleCapacity > minimalCapacity ? doubleCapacity : minimalCapacity]; |
| 357 | System.arraycopy(data, 0, newData, 0, length); |
| 358 | data = newData; |
| 359 | } |
| 360 | } |