Code example for FileChannel

Methods: map, size

0
 
		RandomAccessFile snap = new RandomAccessFile(snapfn,"r");
		 
		FileChannel fc = snap.getChannel();
		 
		MappedByteBuffer map = fc.map(MapMode.READ_ONLY, 0, fc.size());
		map.order(ByteOrder.LITTLE_ENDIAN);
		 
		Visitor v = new Visitor(map);
		 
		v.go();
		 
		VisitedMap visitedMap = v.getMap(); // all visited objects
		 
		Scanner s = new Scanner(map);
			 
		try { 
			s.scan(visitedMap);
		} catch (InvalidPhantomMemoryException e) {
			e.printStackTrace();
		}