public static int Read(this Stream stream) { var buffer = new byte[1]; return stream.Read(buffer) == 1 ? buffer[0] : -1; }