Код: Выделить всё
import java.io.*;
import java.util.*;
public class Locations implements Map {
private static Map locations = new LinkedHashMap();
private static Map index = new LinkedHashMap();
private static RandomAccessFile ra;
static {
try {
ra = new RandomAccessFile("locations_rand.dat", "rwd");
int numLocations = ra.readInt();
long locationStartPoint = ra.readInt();
int i=0;
while(ra.getFilePointer() < locationStartPoint) {
int locationId = ra.readInt();
int locationStart = ra.readInt();
int locationLength = ra.readInt();
IndexRecord record = new IndexRecord(locationStart, locationLength);
index.put(locationId, record);
System.out.println(i++);
}
} catch(IOException e) {
System.out.println("IOException in static initializer: " + e.getMessage());
}
}
public static void main(String[] args) throws IOException {}
Подробнее здесь: https://stackoverflow.com/questions/784 ... -is-loaded