title: Java ByteBuffer, is flip necessary or usefull?
body: <p>I am new to ByteBuffer and I am confuse about buffer.flip() usage. </p>
  
  <ol>
  <li>I know that flip set the limit to position, and position to zero so I think it could be usefull in situations where I have the buffer not full and I read and also write in the buffer, so I preserve the read space and write space, is it right?</li>
  <li>In a situation where I am sure that I don't do any read or write until the buffer is completly full or completly empty, is still usefull to flip?</li>
  </ol>
  
  <p>I tested the following code that return the same result (assume no problem with readyBytes > 0 and also channel.read give me the entire message. <strong>ASSUME</strong> that the buffer became full in the following examples, this are extracted from my entire code):</p>
  
  <p><strong>Example 1</strong>:</p>
  
  <pre><code>int readBytes = channel.read(buffer);
  String message = new String(buffer.array(), 0, buffer.array().length, StandardCharsets.UTF_8);
  </code></pre>
  
  <p><strong>Example 2</strong>:</p>
  
  <pre><code>int readBytes = channel.read(buffer);
  buffer.flip();
  String message = new String(buffer.array(), 0, buffer.array().length, StandardCharsets.UTF_8);
  </code></pre>
  
  <p>What code should I use?</p>
  
  <p>The previous example are a small part, in reality I should write the buffer content in another channel so I will do a out.write(buffer), is there differences between out.write(buffer) operation and transforming the buffer content to a string?</p>