various refinements to network implementation

The main idea is to make DatagramChannel and *SocketChannel behave in
a way that more closely matches the standard, e.g. allow binding
sockets to addresses without necessarily listening on those addresses
and accept null addresses where appropriate.  It also avoids multiple
redundant DNS lookups.

This commit also implements CharBuffer and BindException, and adds the
Readable interface.
This commit is contained in:
Joel Dice
2014-03-28 12:30:20 -06:00
parent 1e1fff58f8
commit 6e7149061c
19 changed files with 713 additions and 184 deletions

View File

@ -54,14 +54,14 @@ class ArrayByteBuffer extends ByteBuffer {
public ByteBuffer put(ByteBuffer src) {
int length = src.remaining();
checkPut(position, length);
checkPut(position, length, false);
src.get(array, arrayOffset + position, length);
position += length;
return this;
}
public ByteBuffer put(byte[] src, int offset, int length) {
checkPut(position, length);
checkPut(position, length, false);
System.arraycopy(src, offset, array, arrayOffset + position, length);
position += length;
@ -70,7 +70,7 @@ class ArrayByteBuffer extends ByteBuffer {
}
public ByteBuffer get(byte[] dst, int offset, int length) {
checkGet(position, length);
checkGet(position, length, false);
System.arraycopy(array, arrayOffset + position, dst, offset, length);
position += length;