org.apache.poi.hssf.util

## Class LazilyConcatenatedByteArray

- java.lang.Object
- - org.apache.poi.hssf.util.LazilyConcatenatedByteArray

-     public class LazilyConcatenatedByteArray
      extends java.lang.Object

  Utility for delaying the concatenation of multiple byte arrays. Doing this up-front causes significantly more copying, which for a large number of byte arrays can cost a large amount of time.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LazilyConcatenatedByteArray()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clears the array (sets the concatenated length back to zero.
    `void` | `concatenate(byte[] array)` Concatenates an array onto the end of our array.
    `void` | `concatenate(LazilyConcatenatedByteArray other)`
    `byte[]` | `toArray()` Gets the concatenated contents as a single byte array.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LazilyConcatenatedByteArray

          public LazilyConcatenatedByteArray()

  - ### Method Detail

    - #### clear

          public void clear()

      Clears the array (sets the concatenated length back to zero.

    - #### concatenate

          public void concatenate(byte[] array)

      Concatenates an array onto the end of our array. This is a relatively fast operation.
      Parameters:
        `array` - the array to concatenate.
      Throws:
        `java.lang.IllegalArgumentException` - if `array` is `null`.

    - #### concatenate

          public void concatenate(LazilyConcatenatedByteArray other)

    - #### toArray

          public byte[] toArray()

      Gets the concatenated contents as a single byte array. This is a slower operation, but the concatenated array is stored off as a single array again so that subsequent calls will not perform additional copying.
      Returns:
        the byte array. Returns `null` if no data has been placed into it.

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.