// reading a file with memoryMapping File file = new File( "somebytes.dat" ); fis = new FileInputStream( file ); FileChannel fc = fis.getChannel(); MappedByteBuffer bb = fc.map( FileChannel.MapMode.READ_ONLY, 0, file.length() ); // bb.flip(); // not needed int limit = bb.limit(); // bytes in buffer for ( int offset=0; offset<limit; offset++ ) { byte b = bb.get( offset ); out.println( b ); }