Java File Read via ByteBuffer readDouble(FileChannel fileChannel, ByteOrder byteOrder)

Here you can find the source of readDouble(FileChannel fileChannel, ByteOrder byteOrder)

Description

read Double

License

Open Source License

Declaration

public static double readDouble(FileChannel fileChannel, ByteOrder byteOrder) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;

public class Main {
    public static double readDouble(FileChannel fileChannel, ByteOrder byteOrder) throws IOException {
        ByteBuffer byteBuffer = ByteBuffer.allocate(8);
        byteBuffer.order(byteOrder);//from  w  w  w .ja  v a2 s. c o m
        fileChannel.read(byteBuffer);
        return byteBuffer.getDouble(0);
    }
}

Related

  1. readContentsNIO(FileInputStream input, String encoding, boolean decodeNIO)
  2. readData(String fileName, int size)
  3. readDelimitedFromInputStream(InputStream inputStream)
  4. readDouble(BufferedReader br, double[] buf)
  5. readDouble(byte[] src, int pointer)
  6. readDouble(final byte[] bytes, final int length, final int offset)
  7. readEntireFile(java.io.File file)
  8. readerToString(Reader reader)
  9. readFC(String fname, int length)