public class StringUtil
extends java.lang.Object
| Constructor and Description |
|---|
StringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
cleanField(java.lang.String value)
Takes in a String value and cleans out any offending "�"
|
static byte[] |
fromHexString(java.lang.String text)
Convert a String containing consecutive (no inside whitespace) hexadecimal
digits into a corresponding byte array.
|
static boolean |
isEmpty(java.lang.String str)
Checks if a string is empty (ie is null or empty).
|
static java.lang.String |
leftPad(java.lang.String s,
int length)
Returns a copy of
s padded with leading spaces so that it's
length is length. |
static void |
main(java.lang.String[] args) |
static java.lang.String |
rightPad(java.lang.String s,
int length)
Returns a copy of
s padded with trailing spaces so that it's
length is length. |
static java.lang.String |
toHexString(byte[] buf)
Convenience call for
toHexString(byte[], String, int), where
sep = null; lineLen = Integer.MAX_VALUE. |
static java.lang.String |
toHexString(byte[] buf,
int of,
int cb,
java.lang.String sep,
int lineLen)
Get a text representation of a byte[] as hexadecimal String, where each
pair of hexadecimal digits corresponds to consecutive bytes in the array.
|
static java.lang.String |
toHexString(byte[] buf,
java.lang.String sep,
int lineLen)
Get a text representation of a byte[] as hexadecimal String, where each
pair of hexadecimal digits corresponds to consecutive bytes in the array.
|
static java.lang.String |
toHexString(java.nio.ByteBuffer buf)
Convenience call for
toHexString(ByteBuffer, String, int), where
sep = null; lineLen = Integer.MAX_VALUE. |
static java.lang.String |
toHexString(java.nio.ByteBuffer buf,
java.lang.String sep,
int lineLen)
Get a text representation of a ByteBuffer as hexadecimal String, where each
pair of hexadecimal digits corresponds to consecutive bytes in the array.
|
public static java.lang.String rightPad(java.lang.String s,
int length)
s padded with trailing spaces so that it's
length is length. Strings already length
characters long or longer are not altered.public static java.lang.String leftPad(java.lang.String s,
int length)
s padded with leading spaces so that it's
length is length. Strings already length
characters long or longer are not altered.public static java.lang.String toHexString(java.nio.ByteBuffer buf)
toHexString(ByteBuffer, String, int), where
sep = null; lineLen = Integer.MAX_VALUE.buf - public static java.lang.String toHexString(java.nio.ByteBuffer buf,
java.lang.String sep,
int lineLen)
buf - input datasep - separate every pair of hexadecimal digits with this separator, or
null if no separation is needed.lineLen - break the output String into lines containing output for lineLen
bytes.public static java.lang.String toHexString(byte[] buf)
toHexString(byte[], String, int), where
sep = null; lineLen = Integer.MAX_VALUE.buf - public static java.lang.String toHexString(byte[] buf,
java.lang.String sep,
int lineLen)
buf - input datasep - separate every pair of hexadecimal digits with this separator, or
null if no separation is needed.lineLen - break the output String into lines containing output for lineLen
bytes.public static java.lang.String toHexString(byte[] buf,
int of,
int cb,
java.lang.String sep,
int lineLen)
buf - input dataof - the offset into the byte[] to start readingcb - the number of bytes to read from the byte[]sep - separate every pair of hexadecimal digits with this separator, or
null if no separation is needed.lineLen - break the output String into lines containing output for lineLen
bytes.public static byte[] fromHexString(java.lang.String text)
text - input textpublic static boolean isEmpty(java.lang.String str)
public static java.lang.String cleanField(java.lang.String value)
value - the dirty String value.public static void main(java.lang.String[] args)
Copyright © 2019 The Apache Software Foundation