public final class Utils extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
FIRST_BYTE_MASK
Bit mask to extract the first byte of a
32 bit number. |
static int |
FOURTH_BYTE_MASK
Bit mask to extract the fourth byte of a
32 bit number. |
static String |
LOG_OUT_INDENT
Indent for each line (dependent of the level of indent).
|
static int |
SECOND_BYTE_MASK
Bit mask to extract the second byte of a
32 bit number. |
static int |
THIRD_BYTE_MASK
Bit mask to extract the third byte of a
32 bit number. |
| Modifier and Type | Method and Description |
|---|---|
static int |
getUnsignedInt(byte b)
This method converts a byte with the highest (sign) bit set, to an
unsigned int value.
|
static long |
getUnsignedLong(int i)
This method converts an integer with the highest (sign) bit set, to an
unsigned long value.
|
static long |
getUnsignedLong(short i)
This method converts an short integer with the highest (sign) bit set, to
an unsigned long value.
|
static boolean |
isBitSet(int num)
Checks with a given int is unequal to zero.
|
static void |
isExpected(int field,
int expected)
Checks for equality of a given value with the expected value.
|
static void |
isReserved(long field)
Method to guarantee that a given field is not zero.
|
static void |
printField(StringBuilder sb,
String fieldName,
boolean fieldValue,
int indent)
This methods creates an easy to use interface to print out a logging
message of a specific variable.
|
static void |
printField(StringBuilder sb,
String fieldName,
ByteBuffer fieldValue,
int indent)
This methods creates an easy to use interface to print out a logging
message of a specific variable.
|
static void |
printField(StringBuilder sb,
String fieldName,
byte fieldValue,
int indent)
This methods creates an easy to use interface to print out a logging
message of a specific variable.
|
static void |
printField(StringBuilder sb,
String fieldName,
int fieldValue,
int indent)
This methods creates an easy to use interface to print out a logging
message of a specific variable.
|
static void |
printField(StringBuilder sb,
String fieldName,
long fieldValue,
int indent)
This methods creates an easy to use interface to print out a logging
message of a specific variable.
|
static void |
printField(StringBuilder sb,
String fieldName,
String fieldValue,
int indent)
This methods creates an easy to use interface to print out a logging
message of a specific variable.
|
public static final String LOG_OUT_INDENT
public static final int FIRST_BYTE_MASK
32 bit number.public static final int SECOND_BYTE_MASK
32 bit number.public static final int THIRD_BYTE_MASK
32 bit number.public static final int FOURTH_BYTE_MASK
32 bit number.public static final void isReserved(long field)
throws InternetSCSIException
field - Field to checkInternetSCSIException - If the field is not reserved, then throw an exceptionpublic static final void isExpected(int field,
int expected)
throws InternetSCSIException
field - This value should be equal to the expected valueexpected - This is what we expectInternetSCSIException - If this comparison failed, this exception will be thrownpublic static final boolean isBitSet(int num)
num - Number to checkpublic static final void printField(StringBuilder sb, String fieldName, String fieldValue, int indent)
sb - StringBuilder to directly write the logging messages in.fieldName - The name of the variable.fieldValue - The value of the given variable.indent - The level of indention.public static final void printField(StringBuilder sb, String fieldName, int fieldValue, int indent)
sb - StringBuilder to directly write the logging messages in.fieldName - The name of the variable.fieldValue - The value of the given variable.indent - The level of indention.public static final void printField(StringBuilder sb, String fieldName, long fieldValue, int indent)
sb - StringBuilder to directly write the logging messages in.fieldName - The name of the variable.fieldValue - The value of the given variable.indent - The level of indention.public static final void printField(StringBuilder sb, String fieldName, byte fieldValue, int indent)
sb - StringBuilder to directly write the logging messages in.fieldName - The name of the variable.fieldValue - The value of the given variable.indent - The level of indention.public static final void printField(StringBuilder sb, String fieldName, boolean fieldValue, int indent)
sb - StringBuilder to directly write the logging messages in.fieldName - The name of the variable.fieldValue - The value of the given variable.indent - The level of indention.public static final void printField(StringBuilder sb, String fieldName, ByteBuffer fieldValue, int indent)
sb - StringBuilder to directly write the logging messages in.fieldName - The name of the variable.fieldValue - The value of the given variable.indent - The level of indention.public static final int getUnsignedInt(byte b)
b - The signed byte number.int number.public static final long getUnsignedLong(int i)
i - The signed int number.long number.public static final long getUnsignedLong(short i)
i - The signed integer number.Copyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.