public class RowDataUtil extends Object
For example, a step adding a field to the row should always call
public static Object[] resizeArray(Object[] objects, int newSize)which will either physically resize the array or return the original row, in case it was over-allocated and has enough slots. If a step needs to create new rows from scratch, it should use allocateRowData() which will return a somewhat over-allocated object array to fit the desired number of fields.
Modifier and Type | Field and Description |
---|---|
static int |
OVER_ALLOCATE_SIZE |
Constructor and Description |
---|
RowDataUtil() |
Modifier and Type | Method and Description |
---|---|
static Object[] |
addRowData(Object[] one,
int sourceLength,
Object[] two)
Add two arrays and make one new one.
|
static Object[] |
addValueData(Object[] rowData,
int length,
Object extra)
Add a single value to a row of data
|
static Object[] |
allocateRowData(int size)
Allocate a new Object array.
|
static Object[] |
createResizedCopy(Object[][] objects,
int[] lengths)
This method concatenates data from an array of rows, each with their own specific length.
|
static Object[] |
createResizedCopy(Object[] objects,
int newSize)
Resize an object array making it bigger, over allocate, always create a copy of the original array, even if there's
enough room in the old one.
|
static Object[] |
removeItem(Object[] objects,
int index)
Remove an item from an Object array.
|
static Object[] |
removeItems(Object[] rowData,
int[] index)
Remove a number of items in a row of data.
|
static Object[] |
resizeArray(Object[] objects,
int newSize)
Resize an object array making it bigger, over allocate, return the original array if there's enough room.
|
public static Object[] allocateRowData(int size)
size
- the minimum size to allocate.public static Object[] resizeArray(Object[] objects, int newSize)
objects
- newSize
- public static Object[] createResizedCopy(Object[] objects, int newSize)
objects
- the original rownewSize
- the new sizepublic static Object[] createResizedCopy(Object[][] objects, int[] lengths)
objects
- lengths
- public static Object[] removeItem(Object[] objects, int index)
objects
- index
- public static Object[] addRowData(Object[] one, int sourceLength, Object[] two)
one
- The first arraythe
- length of the row data or of it's longer, the location of the new extra value in the returned data rowtwo
- The second arraypublic static Object[] addValueData(Object[] rowData, int length, Object extra)
rowData
- The original row of datathe
- length of the row data or of it's longer, the location of the new extra value in the returned data rowextra
- The extra value to add