()
| 53 | } |
| 54 | |
| 55 | public ByteBuffer compact() { |
| 56 | int remaining = remaining(); |
| 57 | |
| 58 | if (position != 0) { |
| 59 | ByteBuffer b = slice(); |
| 60 | position = 0; |
| 61 | put(b); |
| 62 | } |
| 63 | |
| 64 | position = remaining; |
| 65 | limit(capacity()); |
| 66 | |
| 67 | return this; |
| 68 | } |
| 69 | |
| 70 | public ByteBuffer put(ByteBuffer src) { |
| 71 | if (src.hasArray()) { |