1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| private static void init() {
System.out.println(">>>> Parsing >>>");
File f = null;
FileInputStream fis = null;
byte[] ba = null;
try {
// open a file and read the content into a byte array
f = new File(ConfigManager.PATH_TO_HIERARCHY + current_filename);
fis = new FileInputStream(f);
ba = new byte[(int) f.length()];
fis.read(ba);
// to parse the byte buffer
vg = new VTDGen();
vg.setDoc(ba);
vg.parse(true);
vn = vg.getNav();
//
long startTime = System.nanoTime();
startTime = System.nanoTime();
long endTime = System.nanoTime();
//
HalModel.getMetadatas(vn);
endTime = System.nanoTime();
System.out.println("Total elapsed time in execution of method is :"
+ ((endTime - startTime)));
} catch (Exception e) {
System.err.println("exception occurred ==>" + e);
} finally {
try {
fis.read();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
fis = null;
f = null;
vg.clear();
vg = null;
vn = null;
Arrays.fill(ba, (byte) 0);
System.out.println(ba.length);
ba = null;
}
} |
Partager