title: Read memory mapped file
body: <p>I have to read a memory mapped file, writing seems to work but I don't know how to properly read it. This is how I write the file: </p>
  
  <pre><code>public static void writeMapped(ArrayList&lt;Edge&gt; edges) throws FileNotFoundException, IOException{
      // Create file object
      File file = new File("data.txt");
  
      //Delete the file; we will create a new file
      file.delete();
  
      // Get file channel in readonly mode
      FileChannel fileChannel = new RandomAccessFile(file, "rw").getChannel();
      // Get direct byte buffer access using channel.map() operation
      // 7 values * 8 bytes(double = 8byte) 
      MappedByteBuffer buffer = fileChannel.map(FileChannel.MapMode.READ_WRITE, 0, (7*8)*edges.size());
  
      //Write the content using put methods
      for(Edge e : edges){
          buffer.putDouble(e.X1);
          buffer.putDouble(e.Y1);
          buffer.putDouble(e.X2);
          buffer.putDouble(e.Y2);
          buffer.putDouble(e.color.getHue());           
      }
  
      System.out.print("mapped done!");
   }
  </code></pre>
  
  <p>I have to read the file and create the exact same arraylist as I had when I wrote the file.</p>