jdk/test/java/io/Reader/Skip.java
changeset 5810 e83d67ad8c96
parent 5506 202f599c92aa
child 7668 d4a77089c587
equal deleted inserted replaced
5809:6e38efd0293f 5810:e83d67ad8c96
    33 public class Skip {
    33 public class Skip {
    34     public static void main(String argv[]) throws Exception {
    34     public static void main(String argv[]) throws Exception {
    35         File f = new File(System.getProperty("test.src", "."),
    35         File f = new File(System.getProperty("test.src", "."),
    36                           "SkipInput.txt");
    36                           "SkipInput.txt");
    37         FileReader fr = new FileReader(f);
    37         FileReader fr = new FileReader(f);
    38         long nchars = 8200;
    38         try {
    39         long actual = fr.skip(nchars);
    39             long nchars = 8200;
       
    40             long actual = fr.skip(nchars);
    40 
    41 
    41         if (actual > nchars) {
    42             if (actual > nchars) {
    42             throw new Exception
    43                 throw new Exception
    43                 ("Should skip " + nchars + ", but skipped " +actual+" chars");
    44                     ("Should skip " + nchars + ", but skipped " +actual+" chars");
       
    45             }
       
    46         } finally {
       
    47             fr.close();
    44         }
    48         }
    45     }
    49     }
    46 }
    50 }