title: MappedByteBuffer writing to file not working
body: <p>I am having hard time understanding the read write with MappedByteBuffer.
  Here is the class I have that reads the content of a local file and suppose to reverse its content. I am using java version 8.</p>
  
  <pre><code>public class MappedByteBufferExample {
  public static void main(String[] args) {
      try (RandomAccessFile file = new RandomAccessFile("resources\\MappedByteBufferExample.txt", "rw");
              FileChannel fileChannel = file.getChannel();) {
          long size = fileChannel.size();
          MappedByteBuffer mappedBuffer = fileChannel.map(MapMode.READ_WRITE, 0, size);
  
          System.out.println("Text from File : -----");
          while (mappedBuffer.remaining() &gt; 0) {
              System.out.print((char) mappedBuffer.get());
          }
          System.out.println("\n");
  
          for (int index = 0; index &lt; (mappedBuffer.limit() / 2); index++) {
              byte b1 = mappedBuffer.get(index);
              byte b2 = mappedBuffer.get(mappedBuffer.limit() - index - 1);
              mappedBuffer.put(index, b2);
              mappedBuffer.put(mappedBuffer.limit() - index - 1, b1);
          }
          //mappedBuffer.force();  I tried with this but no change in result.
          //mappedBuffer.load(); I tried with this but no change in result.
          mappedBuffer.load();
          mappedBuffer.flip();
          System.out.println("Text Reversed : -----");
          while (mappedBuffer.remaining() &gt; 0) {
              System.out.print((char) mappedBuffer.get());
          }
      } catch (IOException e) {
          e.printStackTrace();
      }
  }}
  </code></pre>
  
  <p>The content of the file is - Roses are Red!<br>
  On executing this file output to the console is:</p>
  
  <p>Text from File : -----</p>
  
  <p>Roses are Red!</p>
  
  <p>Text Reversed : -----</p>
  
  <p>!deR era sesoR</p>
  
  <p>But the content of the file is unchanged.
  On executing this program on second time, the output to the console is:</p>
  
  <p>Text from File : -----</p>
  
  <p>!deR era sesoR</p>
  
  <p>Text Reversed : -----</p>
  
  <p>Roses are Red!</p>
  
  <p>The content of the file is still unchanged.
  I tried load() and force() methods one at a time and both, but no change in the result
  Here are my questions:</p>
  
  <p>1) Why the content of the local file is not changed?</p>
  
  <p>2) What changes does this program need to make the data to be written to the file?</p>
  
  <p>3) Why/How the MappedByteBuffer has read reversed text on second iteration, though the file content is not reversed?</p>