Oebele

Java Buffers

Dec 23rd, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1. IntBuffer buff = BufferUtils.createIntBuffer(8);
  2.  
  3. // First I want it to contain [1, 1, 1, 1]
  4. buff.put(new int[]{1, 1, 1, 1});
  5.  
  6. // Now I have to read this data, so I flip it
  7. buff.flip();
  8.        
  9. // Now I want the buffer to contain [1, 1, 1, 1, 2, 2]
  10. //how? the limit is now 4, so I cannot write more than 4 elements...
Advertisement
Add Comment
Please, Sign In to add comment