|
||||||||||
| 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(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 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 |
isOneValueMinusOne(int[] values)
Returns whether one of the given numbers is equal to -1. |
static void |
logThrownThrowable(Throwable t)
Logs that the given Throwable has been thrown. |
static String |
toHexString(int number)
Returns a string representation of the integer argument as an unsigned integer in base 16. For example: 100 → 0x64 |
| 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(InputStream in,
int magic)
throws FileFormatException,
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
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(Throwable t)
Throwable has been thrown.
t - the thrown Throwable to logpublic static String toHexString(int number)
100 → 0x64
number - the number to represent as hexadecimal string
0x
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.public static String getLineSeparator()
String that represents the line separator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||