private int readHeaderInt() { int res = 0; byte b = 0; b = countedByteRead(); while (b != 32 && b != 10 && b != 9 && b != 13) { // While not whitespace res = res * 10 + b - 48; // Convert from ASCII to decimal b = countedByteRead(); } return res; }