Package ru.yandex.clickhouse.util
Class Utils
- java.lang.Object
-
- ru.yandex.clickhouse.util.Utils
-
public class Utils extends Object
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckArgument(byte[] value, int length)static voidcheckArgument(int value, int minValue)static voidcheckArgument(int value, int minValue, int maxValue)static voidcheckArgument(long value, long minValue)static voidcheckArgument(long value, long minValue, long maxValue)static voidcheckArgument(BigInteger value, BigInteger minValue)static voidcheckArgument(BigInteger value, BigInteger minValue, BigInteger maxValue)static longcopy(InputStream from, OutputStream to)static intgetVarIntSize(int value)static intgetVarLongSize(long value)static booleanisNullOrEmptyString(String str)static List<Object>listOf(Object... values)static Map<Object,Object>mapOf(Object... kvps)static BigIntegerreadBigInteger(DataInputStream inputStream, int byteLength)static voidreadFully(DataInputStream in, byte[] b)static voidreadFully(DataInputStream in, byte[] b, int off, int len)static intreadInt(DataInputStream inputStream)static longreadLong(DataInputStream inputStream)static BigIntegerreadLongAsBigInteger(DataInputStream inputStream)static intreadUnsignedLeb128(DataInputStream inputStream)static intreadUnsignedShort(DataInputStream inputStream)static intreadVarInt(DataInput in)static intreadVarInt(ByteBuffer buffer)static StringretainUnquoted(String haystack, char quoteChar)static booleanstartsWithIgnoreCase(String haystack, String pattern)static BigIntegertoBigInteger(BigDecimal num, int scale)static byte[]toByteArray(InputStream in)static StringtoString(InputStream in)static <T> Class<T>unwrap(Class<T> type)static voidwriteBigInteger(DataOutputStream outputStream, BigInteger value, int byteLength)static voidwriteInt(DataOutputStream outputStream, int value)static voidwriteLong(DataOutputStream outputStream, long value)static voidwriteShort(DataOutputStream outputStream, int value)static voidwriteVarInt(int value, ByteBuffer buffer)
-
-
-
Method Detail
-
toString
public static String toString(InputStream in) throws IOException
- Throws:
IOException
-
toByteArray
public static byte[] toByteArray(InputStream in) throws IOException
- Throws:
IOException
-
copy
public static long copy(InputStream from, OutputStream to) throws IOException
- Throws:
IOException
-
isNullOrEmptyString
public static boolean isNullOrEmptyString(String str)
-
checkArgument
public static void checkArgument(byte[] value, int length)
-
checkArgument
public static void checkArgument(int value, int minValue)
-
checkArgument
public static void checkArgument(long value, long minValue)
-
checkArgument
public static void checkArgument(int value, int minValue, int maxValue)
-
checkArgument
public static void checkArgument(long value, long minValue, long maxValue)
-
checkArgument
public static void checkArgument(BigInteger value, BigInteger minValue)
-
checkArgument
public static void checkArgument(BigInteger value, BigInteger minValue, BigInteger maxValue)
-
readFully
public static void readFully(DataInputStream in, byte[] b) throws IOException
- Throws:
IOException
-
readFully
public static void readFully(DataInputStream in, byte[] b, int off, int len) throws IOException
- Throws:
IOException
-
readUnsignedShort
public static int readUnsignedShort(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
readInt
public static int readInt(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
readLong
public static long readLong(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
readLongAsBigInteger
public static BigInteger readLongAsBigInteger(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
readUnsignedLeb128
public static int readUnsignedLeb128(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
readBigInteger
public static BigInteger readBigInteger(DataInputStream inputStream, int byteLength) throws IOException
- Throws:
IOException
-
writeShort
public static void writeShort(DataOutputStream outputStream, int value) throws IOException
- Throws:
IOException
-
writeInt
public static void writeInt(DataOutputStream outputStream, int value) throws IOException
- Throws:
IOException
-
writeLong
public static void writeLong(DataOutputStream outputStream, long value) throws IOException
- Throws:
IOException
-
writeBigInteger
public static void writeBigInteger(DataOutputStream outputStream, BigInteger value, int byteLength) throws IOException
- Throws:
IOException
-
getVarIntSize
public static int getVarIntSize(int value)
-
getVarLongSize
public static int getVarLongSize(long value)
-
writeVarInt
public static void writeVarInt(int value, ByteBuffer buffer)
-
readVarInt
public static int readVarInt(DataInput in) throws IOException
- Throws:
IOException
-
readVarInt
public static int readVarInt(ByteBuffer buffer)
-
toBigInteger
public static BigInteger toBigInteger(BigDecimal num, int scale)
-
-