解决方案 »

  1.   

    /**
         * 内存映射
         * 
         * @throws IOException
         */
        public static void mapChannel() throws IOException {
            long t1 = System.currentTimeMillis();
            FileInputStream in = new FileInputStream("d:/1.txt");
            long size = in.available();
            RandomAccessFile out = new RandomAccessFile("d:/2.txt", "rw");
            FileChannel inc = in.getChannel();
            MappedByteBuffer bf = inc.map(FileChannel.MapMode.READ_ONLY, 0, size);
            FileChannel outc = out.getChannel();
            MappedByteBuffer outbf = outc.map(FileChannel.MapMode.READ_WRITE, 0, size);
            outbf.put(bf);
            inc.close();
            outc.close();
            in.close();
            out.close();
            long t2 = System.currentTimeMillis();
            System.out.println(t2 - t1);
        }
    (完全的内存映射)读文件是最快的,比任何其它读取方式快40倍,但你要BufferedImage结果那只能读到内存了
      

  2.   

    Imageio.read(new File(路径)); 
    不只是读取文件,还要解析图像。
      

  3.   

    你试试比较一下使用BufferedInputStream(InputStream in, int size),把缓冲设置的大一点。与nio比较一下,给大家个回复。
      

  4.   

    楼主看看这个帖子:http://www.iteye.com/topic/866622
      

  5.   

    你试试比较一下使用BufferedInputStream(InputStream in, int size),把缓冲设置为1024 * 32(我的机器,你的机器可能更大一点)。与nio比较一下,给大家个回复。