public class DrillStringUtils extends Object
| Constructor and Description |
|---|
DrillStringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeJava(String input)
Escapes the characters in a
String according to Java string literal
rules. |
static String |
escapeNewLines(String input) |
static String |
escapeSql(String str)
Copied form commons-lang 2.x code as common-lang 3.x has this API removed.
|
static int |
parseBinaryString(io.netty.buffer.ByteBuf str,
int strStart,
int strEnd,
io.netty.buffer.ByteBuf out)
parsing a hex encoded binary string and write to an output buffer.
|
static String |
readable(long bytes)
Converts the long number into more human readable string.
|
static String |
removeLeadingSlash(String path)
Removes all leading slash characters from specified string.
|
static String |
sanitizeCSV(String csv)
Removes extra spaces and empty values in a CSV String
|
static String |
toBinaryString(byte[] buf)
Return a printable representation of a byte array, escaping the non-printable
bytes as '\\xNN' where NN is the hexadecimal representation of such bytes.
|
static String |
toBinaryString(byte[] buf,
int strStart,
int strEnd)
Return a printable representation of a byte array, escaping the non-printable
bytes as '\\xNN' where NN is the hexadecimal representation of such bytes.
|
static String |
toBinaryString(io.netty.buffer.ByteBuf buf,
int strStart,
int strEnd)
Return a printable representation of a byte buffer, escaping the non-printable
bytes as '\\xNN' where NN is the hexadecimal representation of such bytes.
|
static String |
unescapeJava(String input)
Unescapes any Java literals found in the
String. |
public static String readable(long bytes)
public static String unescapeJava(String input)
String.
For example, it will turn a sequence of '\' and
'n' into a newline character, unless the '\'
is preceded by another '\'.input - the String to unescape, may be nullString, null if null string inputpublic static String escapeJava(String input)
String according to Java string literal
rules.
Deals correctly with quotes and control-chars (tab, backslash, cr, ff,
etc.) so, for example, a tab becomes the characters '\\' and
't'.
Example:
input string: He didn't say, "Stop!" output string: He didn't say, \"Stop!\"
input - String to escape values in, may be nullnull if null string inputpublic static String escapeSql(String str)
str - public static String toBinaryString(io.netty.buffer.ByteBuf buf, int strStart, int strEnd)
readerIndex and writerIndex
of the byte buffer.public static String toBinaryString(byte[] buf)
public static String toBinaryString(byte[] buf, int strStart, int strEnd)
public static int parseBinaryString(io.netty.buffer.ByteBuf str,
int strStart,
int strEnd,
io.netty.buffer.ByteBuf out)
readerIndex and writerIndex
of the byte buffer.public static String sanitizeCSV(String csv)
csv - The CSV string to be sanitizedCopyright © 2021 The Apache Software Foundation. All rights reserved.