public final class ByteUtils extends Object
byte
arrays.Modifier and Type | Method and Description |
---|---|
static byte[] |
concat(byte[] array1,
byte[] array2)
Concatenate the given
byte arrays into one, with overlapping array elements included twice. |
static byte[] |
concatAll(byte[]... arrays)
Concatenate the given
byte arrays into one, with overlapping array elements included twice. |
static byte[] |
getBytes(ByteBuffer byteBuffer)
Extract a byte array from
ByteBuffer without consuming it. |
static byte[][] |
mergeArrays(byte[] firstArray,
byte[]... additionalArrays)
Merge multiple
byte arrays into one array |
static byte[][] |
split(byte[] source,
int c)
Split
source into partitioned arrays using delimiter c . |
public static byte[] concat(byte[] array1, byte[] array2)
byte
arrays into one, with overlapping array elements included twice.
The order of elements in the original arrays is preserved.array1
- the first array.array2
- the second array.public static byte[] concatAll(byte[]... arrays)
byte
arrays into one, with overlapping array elements included twice. Returns a new,
empty array if arrays
was empty and returns the first array if arrays
contains only a single array.
The order of elements in the original arrays is preserved.arrays
- the arrays.public static byte[][] split(byte[] source, int c)
source
into partitioned arrays using delimiter c
.source
- the source array.c
- delimiter.public static byte[][] mergeArrays(byte[] firstArray, byte[]... additionalArrays)
byte
arrays into one arrayfirstArray
- must not be nulladditionalArrays
- must not be nullpublic static byte[] getBytes(ByteBuffer byteBuffer)
ByteBuffer
without consuming it.byteBuffer
- must not be null.Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.