private static void dotest(DataInputStream dis, int pos, int total, int toskip, int expected) { try { if (VERBOSE) { Console.WriteLine("\n\nTotal bytes in the stream = " + total); Console.WriteLine("Currently at position = " + pos); Console.WriteLine("Bytes to skip = " + toskip); Console.WriteLine("Expected result = " + expected); } int skipped = dis.SkipBytes(toskip); if (VERBOSE) { Console.WriteLine("Actual skipped = " + skipped); } if (skipped != expected) { fail("DataInputStream.skipBytes does not return expected value"); } } catch (EndOfStreamException e) { fail("DataInputStream.skipBytes throws unexpected EOFException"); } catch (IOException e) { Console.WriteLine("IOException is thrown - possible result"); } }