Denzel Denzel - 1 month ago 10
Java Question

What is the difference between limit and capacity in ByteBuffer?

What is the difference between limit and capacity in Java's java.nio.ByteBuffer?

Answer

Its best illustrated HERE in this article: They main different depending on the mode,

  • In Write Mode, Capacity and Limit are Same.
  • But in Read mode Limit means the limit of how much data you can read from the data

enter image description here