public class Utils extends Object
| 构造器和说明 |
|---|
Utils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
arrayToString(Object[] a,
StringBuilder b,
String delimiter)
Use
StringBuilder to build string out of an array. |
static String |
arrayToString(Object[] a,
StringBuilder b,
String delimiter,
boolean newLine)
Use
StringBuilder to build string out of an array. |
static <O> O |
cast(Object object) |
static int |
castCompare(Object recordKey,
Object targetKey) |
static void |
close(Closeable closeable) |
static int[] |
getBitArray(SliceInput input,
int numOfBits)
对于null超过8个字段byte[]是LSB,即排序高的字段在低字节里面。
|
static <T> List<String> |
getFromBitArray(List<T> list,
int[] bitArray,
java.util.function.Function<T,String> func) |
static String |
humanReadableBytes(long bytes) |
static String |
humanReadableBytes(long bytes,
boolean si) |
static Long |
maybeUndefined(long val) |
static Object |
tryCastString(Object object,
String type) |
public static <O> O cast(Object object)
public static String humanReadableBytes(long bytes)
public static String humanReadableBytes(long bytes, boolean si)
public static Long maybeUndefined(long val)
public static int[] getBitArray(SliceInput input, int numOfBits)
低位 高位
col9 col2 col4
[00000001][0,1,0,1,0,0,0,0]
input - SliceInputnumOfBits - number of bitspublic static <T> List<String> getFromBitArray(List<T> list, int[] bitArray, java.util.function.Function<T,String> func)
public static void close(Closeable closeable) throws IOException
IOExceptionpublic static String arrayToString(Object[] a, StringBuilder b, String delimiter)
StringBuilder to build string out of an array.
Sometimes by reusing StringBuilder, we can avoid creating many StringBuilder and good to garbage collection.
a - arrayb - reusable StringBuilderdelimiter - delimiterpublic static String arrayToString(Object[] a, StringBuilder b, String delimiter, boolean newLine)
StringBuilder to build string out of an array.
Sometimes by reusing StringBuilder, we can avoid creating many StringBuilder and good to garbage collection.
a - arrayb - reusable StringBuilderdelimiter - delimiternewLine - if this is a new line, if true, write slash n at the endCopyright © 2019–2020 Alibaba Group Holding Limited. All rights reserved.