jdk/test/java/io/RandomAccessFile/ParameterCheck.java
changeset 5810 e83d67ad8c96
parent 5506 202f599c92aa
child 7668 d4a77089c587
equal deleted inserted replaced
5809:6e38efd0293f 5810:e83d67ad8c96
    42                                  false, false };
    42                                  false, false };
    43     static int numBad = 0;
    43     static int numBad = 0;
    44 
    44 
    45     private static void doTest(String method) throws Exception {
    45     private static void doTest(String method) throws Exception {
    46         File fn = new File("x.ParameterCheck");
    46         File fn = new File("x.ParameterCheck");
       
    47         RandomAccessFile raf = null;
    47 
    48 
    48         try {
    49         try {
    49             byte b[] = new byte[32];
    50             byte b[] = new byte[32];
    50             int numCases = off.length;
    51             int numCases = off.length;
    51             int[] got = new int[numCases];
    52             int[] got = new int[numCases];
    53             FileOutputStream fout = new FileOutputStream(fn);
    54             FileOutputStream fout = new FileOutputStream(fn);
    54             for (int i = 0; i < 32; i++) {
    55             for (int i = 0; i < 32; i++) {
    55                 fout.write(i);
    56                 fout.write(i);
    56             }
    57             }
    57             fout.close();
    58             fout.close();
    58             RandomAccessFile raf =  new RandomAccessFile(fn , "rw");
    59             raf =  new RandomAccessFile(fn , "rw");
    59 
    60 
    60             System.err.println("-----------------------------" +
    61             System.err.println("-----------------------------" +
    61                                "-----------------------------");
    62                                "-----------------------------");
    62             System.err.println("\nRandomAccessFile." + method +
    63             System.err.println("\nRandomAccessFile." + method +
    63                                "\nTotal test cases = " + (off.length+1));
    64                                "\nTotal test cases = " + (off.length+1));
   123 
   124 
   124             System.err.println("\nTotal passed = " + numGood);
   125             System.err.println("\nTotal passed = " + numGood);
   125             System.err.println("-----------------------------" +
   126             System.err.println("-----------------------------" +
   126                                "-----------------------------");
   127                                "-----------------------------");
   127         } finally {
   128         } finally {
       
   129             if (raf != null)
       
   130                 raf.close();
   128             fn.delete();
   131             fn.delete();
   129         }
   132         }
   130 
   133 
   131     }
   134     }
   132 
   135