Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.nio.ByteBuffer;
- class BBTest
- {
- public static void main(String[] args)
- {
- ByteBuffer bb1 = ByteBuffer.wrap("foobar".getBytes());
- ByteBuffer bb2 = ByteBuffer.wrap("bar".getBytes());
- bb1.get(new byte[3]);
- assert bb1.remaining() == bb2.remaining();
- for (int i = 0; i < bb1.remaining(); ++i)
- {
- assert bb1.get(bb1.position() + i) == bb2.get(bb2.position() + i);
- }
- assert bb1 == bb2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement