1 7 8 package org.jboss.media.util; 9 10 import java.io.FileInputStream ; 11 import java.io.IOException ; 12 import java.nio.MappedByteBuffer ; 13 import java.nio.channels.FileChannel ; 14 15 21 public class FileChannelUtils 22 { 23 public MappedByteBuffer getMappedByte(String fileName) throws IOException  24 { 25 FileChannel fileChannel = new FileInputStream (fileName).getChannel(); 26 int fileSize = (int) fileChannel.size(); 27 MappedByteBuffer mappedfile = 28 fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileSize); 29 mappedfile.load(); 30 return mappedfile; 31 } 32 } 33 | Popular Tags |