Code example for RandomAccessFile

Methods: getChannel

     * enough that we'll just keep the byte[] in memory. 
    private static ByteBuffer mapData() {
        RandomAccessFile file = null;
        try { 
            file = new RandomAccessFile(ZONE_FILE_NAME, "r");
            FileChannel channel = file.getChannel();
            ByteBuffer buffer =, 0, channel.size());
            return buffer;
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        } finally { 
    private static TimeZone makeTimeZone(String id) throws IOException {
        // Work out where in the big data file this time zone is. 
        int index = Arrays.binarySearch(ids, id);
Contextual code suggestions in your IDE  Get Codota for Java