|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.croesch.micro_debug.commons.Utils
public final class Utils
Class with utility methods.
| Method Summary | |
|---|---|
static int |
bytesToInt(byte b0,
byte b1,
byte b2,
byte b3)
Assembles the given bytes to one integer. |
static void |
checkMagicNumber(java.io.InputStream in,
int magic)
Reads the first four bytes of the given InputStream and throws an exception if they aren't equal to the
expected magic number. |
static java.lang.String |
getLineSeparator()
Returns the line separator that is default for this system. |
static int |
getNextHigherValue(int start,
int... values)
Giving a start value this iterates over all the other given values and returns the minimum of them that is higher than the given start value. |
static boolean |
isNullOrEmpty(java.lang.String str)
Returns whether the given String is null or empty. |
static boolean |
isOneValueMinusOne(int[] values)
Returns whether one of the given numbers is equal to -1. |
static void |
logThrownThrowable(java.lang.Throwable t)
Logs that the given Throwable has been thrown. |
static java.lang.String |
toBinaryString(int number)
Returns the binary string representation of the integer argument. For example: 6 → 0000 0000 0000 0000 0000 0000 0000 0110 |
static java.lang.String |
toHexString(int number)
Returns a string representation of the integer argument as an unsigned integer in base 16. For example: 100 → 0x64 |
static java.lang.String |
toString(java.lang.Object obj)
Returns the Object.toString() representation of the given object or an empty String if the object is
null. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isOneValueMinusOne(int[] values)
-1.
values - the numbers to check if any is equal to -1.
true, if at least one of the given values is equal to -1.
public static void checkMagicNumber(java.io.InputStream in,
int magic)
throws FileFormatException,
java.lang.IllegalArgumentException
InputStream and throws an exception if they aren't equal to the
expected magic number.
in - the stream to read the bytes frommagic - the magic number
java.lang.IllegalArgumentException - if the given stream is null.
FileFormatException - if:
IOException occurs
public static int bytesToInt(byte b0,
byte b1,
byte b2,
byte b3)
b0 - the most significant byteb1 - the second most significant byteb2 - the second least significant byteb3 - the least significant byte
public static void logThrownThrowable(java.lang.Throwable t)
Throwable has been thrown.
t - the thrown Throwable to log@NotNull public static java.lang.String toHexString(int number)
100 → 0x64
number - the number to represent as hexadecimal string
0x@NotNull public static java.lang.String toBinaryString(int number)
6 → 0000 0000 0000 0000 0000 0000 0000 0110
number - the number to represent as binary string
public static int getNextHigherValue(int start,
int... values)
start - the number to start fromvalues - the other numbers to iterate over and to search for the next higher value
Integer.MAX_VALUE if no value is higher than the given start number.@NotNull public static java.lang.String getLineSeparator()
String that represents the line separator@Nullable public static java.lang.String toString(java.lang.Object obj)
Object.toString() representation of the given object or an empty String if the object is
null.
obj - the object
String representation of the object or an empty String if the Object is
null.public static boolean isNullOrEmpty(java.lang.String str)
String is null or empty. A String containing only
whitespaces is also considered to be empty.
str - the String to check if it's null or empty.
true if the given String is either null or empty,false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||