public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static String |
after(String line,
char ch) |
static String |
before(String line,
char ch) |
static String |
bytesToHex(byte[] bytes) |
static String |
bytesToHex(byte[] bytes,
int bytesPerLine,
boolean separateBytes,
boolean showText) |
static String |
bytesToHex(byte[] bytes,
int off,
int len) |
static String |
bytesToHex(byte[] bytes,
int off,
int len,
int bytesPerLine,
boolean separateBytes,
boolean showText) |
static String |
csv(Collection<String> elements) |
static String |
csv(String... elements) |
static String |
csv(String separator,
Collection<String> elements) |
static String |
csv(String separator,
String... elements) |
static byte[] |
digest(Digest digest,
byte[] data) |
static String |
exec(String... cmd) |
static String |
getAddress(String address) |
static int |
getPort(String address) |
static byte[] |
getUTF8Bytes(String value) |
static boolean |
hasPort(String address) |
static byte[] |
hexToBytes(String s)
Converts a hex string to bytes.
|
static boolean |
isBlank(String base) |
static boolean |
isNotBlank(String base) |
static boolean |
isNull(Object result) |
static String |
leftPad(String s,
int n) |
static int |
nearestMultipleOf(int length,
int i) |
static boolean |
nonNull(Object result) |
static String |
randomAlphaNumericString(int length) |
static String |
rightPad(String s,
int n) |
static byte[] |
sha1(byte[] data) |
static byte[] |
sha256(byte[] data) |
static byte[] |
sha512(byte[] data) |
static byte[] |
stripLeadingZeros(byte[] data) |
static String[] |
toArray(String... values) |
public static String bytesToHex(byte[] bytes)
public static String bytesToHex(byte[] bytes, int off, int len)
public static String bytesToHex(byte[] bytes, int bytesPerLine, boolean separateBytes, boolean showText)
public static String bytesToHex(byte[] bytes, int off, int len, int bytesPerLine, boolean separateBytes, boolean showText)
public static byte[] stripLeadingZeros(byte[] data)
public static int nearestMultipleOf(int length, int i)
public static String csv(Collection<String> elements)
public static String randomAlphaNumericString(int length)
public static String csv(String separator, Collection<String> elements)
public static boolean isNotBlank(String base)
public static boolean isBlank(String base)
public static byte[] getUTF8Bytes(String value)
public static byte[] hexToBytes(String s)
s
- the hex string to be converted.public static String exec(String... cmd) throws IOException, InterruptedException
IOException
InterruptedException
public static byte[] sha1(byte[] data)
public static byte[] sha256(byte[] data)
public static byte[] sha512(byte[] data)
public static byte[] digest(Digest digest, byte[] data)
public static boolean nonNull(Object result)
public static boolean isNull(Object result)
public static boolean hasPort(String address)
public static int getPort(String address)
Copyright © 2024. All rights reserved.