Package org.apache.poi.hssf.util
Class LazilyConcatenatedByteArray
- java.lang.Object
-
- org.apache.poi.hssf.util.LazilyConcatenatedByteArray
-
public class LazilyConcatenatedByteArray extends 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 Description LazilyConcatenatedByteArray()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
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:
IllegalArgumentException
- ifarray
isnull
.
-
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.
-
-