Java Tip: Be Wary of a New or Cleared java.nio.Buffer
Normally, before writing to a java.nio.Buffer, you should call its clear() method. In a project I am currently working on, I may not be able to process all of the data in a buffer before I need to read into it again. In those cases, compact() should be called instead of clear() so that the […]