test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java
changeset 57482 2e63fb0a885f
parent 55694 7b7df2be6219
child 57579 1edf6cc224fb
equal deleted inserted replaced
55716:a5d52b0e3798 57482:2e63fb0a885f
   161     }
   161     }
   162 
   162 
   163     public static void writeData(FileChannel fc, long offset, ByteBuffer bb) throws Exception {
   163     public static void writeData(FileChannel fc, long offset, ByteBuffer bb) throws Exception {
   164         fc.position(offset);
   164         fc.position(offset);
   165         fc.write(bb);
   165         fc.write(bb);
   166         fc.force(true);
       
   167     }
   166     }
   168 
   167 
   169     public static FileChannel getFileChannel(File jsaFile) throws Exception {
   168     public static FileChannel getFileChannel(File jsaFile) throws Exception {
   170         List<StandardOpenOption> arry = new ArrayList<StandardOpenOption>();
   169         List<StandardOpenOption> arry = new ArrayList<StandardOpenOption>();
   171         arry.add(READ);
   170         arry.add(READ);
   245         while (bytes_written < used[region]) {
   244         while (bytes_written < used[region]) {
   246             writeData(fc, region_start_offset + bytes_written, bbuf);
   245             writeData(fc, region_start_offset + bytes_written, bbuf);
   247             bbuf.clear();
   246             bbuf.clear();
   248             bytes_written += 4096;
   247             bytes_written += 4096;
   249         }
   248         }
   250         fc.force(true);
       
   251         if (fc.isOpen()) {
   249         if (fc.isOpen()) {
   252             fc.close();
   250             fc.close();
   253         }
   251         }
   254         return true;
   252         return true;
   255     }
   253     }