title: what if we exceed the capacity of allocating buffer in ByteBuffer.allocate(48) NIO package class in java
body: <pre><code> file = new RandomAccessFile("xanadu.txt", "rw");
          FileChannel channel = file.getChannel();
          ByteBuffer buffer = ByteBuffer.allocate(48);
          int byteReads = channel.read(buffer);
  </code></pre>
  
  <p>SO I am allocating 48 as a capacity in the Buffer. Now
  consider the txt file I am reading is of about 10MB , so logically it is crossing the buffer allocation size.
  But when we try to read, we will be able to read all the contents of the file despite the size.
  SO how this thing is possible.</p>
  
  <p><em>I am new to this streaming field so may be my question seems to be very basic.</em></p>