import java.io.RandomAccessFile; class ReadGHFile { public static void main(String[] args) throws Exception { String name = args[0]; RandomAccessFile raFile = new RandomAccessFile(name, "r"); raFile.seek(0); if (raFile.length() == 0) throw new IllegalArgumentException("empty file " + name); String versionHint = raFile.readUTF(); if (!"GH".equals(versionHint)) throw new IllegalArgumentException("Not a GraphHopper file! Expected 'GH' as file marker but was " + versionHint); System.out.println("bytes: " + raFile.readLong()); System.out.println("seg size:" + raFile.readInt()); for (int i = 0; i < 20; i++) { System.out.println(i+"\t: " + raFile.readInt()); } } }