(ByteBuffer b)
| 105 | } |
| 106 | |
| 107 | public int read(ByteBuffer b) throws IOException { |
| 108 | if (! isOpen()) return -1; |
| 109 | if (b.remaining() == 0) return 0; |
| 110 | |
| 111 | byte[] array = b.array(); |
| 112 | if (array == null) throw new NullPointerException(); |
| 113 | |
| 114 | int r = natRead(socket, array, b.arrayOffset() + b.position(), b.remaining(), blocking); |
| 115 | if (r > 0) { |
| 116 | b.position(b.position() + r); |
| 117 | } |
| 118 | return r; |
| 119 | } |
| 120 | |
| 121 | public int write(ByteBuffer b) throws IOException { |
| 122 | if (! connected) { |