Here you can find the source of readFileDataIntoBufferBE(FileChannel fc, final int size)
public static ByteBuffer readFileDataIntoBufferBE(FileChannel fc, final int size) throws IOException
//package com.java2s; /*/* ww w. jav a 2 s. c o m*/ * Copyright (c) 2017 Eric A. Snell * * This file is part of eAlvaTag. * * eAlvaTag is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * eAlvaTag is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with eAlvaTag. If not, * see <http://www.gnu.org/licenses/>. */ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.channels.FileChannel; public class Main { public static ByteBuffer readFileDataIntoBufferBE(FileChannel fc, final int size) throws IOException { final ByteBuffer tagBuffer = ByteBuffer.allocateDirect(size); fc.read(tagBuffer); tagBuffer.position(0); tagBuffer.order(ByteOrder.BIG_ENDIAN); return tagBuffer; } }