Code example for FileChannel

Methods: mapsize

0
    private static ByteBuffer mapData() {
        RandomAccessFile file = null;
        try { 
            file = new RandomAccessFile(ZONE_FILE_NAME, "r");
            FileChannel channel = file.getChannel();
            ByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
            buffer.order(ByteOrder.BIG_ENDIAN);
            return buffer;
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        } finally { 
            IoUtils.closeQuietly(file);
        } 
    } 
 
    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);
        if (index < 0) {
            return null; 
Contextual code suggestions in your IDE  Get Codota for Java