public static void printFields(Class<?> javaClass) { final String className = javaClass.getSimpleName(); TTY.println(className + " {"); for (final Field field : javaClass.getFields()) { printField(field, false); } TTY.println("}"); }
/** * Prints entries in a byte array as space separated hex values to {@link TTY}. * * @param address an address at which the bytes are located. This is used to print an address * prefix per line of output. * @param array the array containing the bytes to print * @param offset the offset in {@code array} of the values to print * @param length the number of values from {@code array} print * @param bytesPerLine the number of values to print per line of output */ public static void printBytes( long address, byte[] array, int offset, int length, int bytesPerLine) { assert bytesPerLine > 0; boolean newLine = true; for (int i = 0; i < length; i++) { if (newLine) { TTY.printf("%08x: ", address + i); newLine = false; } TTY.printf("%02x ", array[i]); if (i % bytesPerLine == bytesPerLine - 1) { TTY.println(); newLine = true; } } if (length % bytesPerLine != bytesPerLine) { TTY.println(); } }
public static void printSection(String name, char sectionCharacter) { String header = " " + name + " "; int remainingCharacters = PRINTING_LINE_WIDTH - header.length(); int leftPart = remainingCharacters / 2; int rightPart = remainingCharacters - leftPart; for (int i = 0; i < leftPart; i++) { TTY.print(sectionCharacter); } TTY.print(header); for (int i = 0; i < rightPart; i++) { TTY.print(sectionCharacter); } TTY.println(); }
public static void warning(String string) { TTY.println("WARNING: " + string); }