mirror of
https://github.com/corda/corda.git
synced 2025-06-13 12:48:18 +00:00
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:
@ -10,7 +10,21 @@
|
||||
|
||||
package java.io;
|
||||
|
||||
public abstract class Reader implements Closeable {
|
||||
import java.nio.CharBuffer;
|
||||
|
||||
public abstract class Reader implements Closeable, Readable {
|
||||
public int read(CharBuffer buffer) throws IOException {
|
||||
int c = read(buffer.array(),
|
||||
buffer.arrayOffset() + buffer.position(),
|
||||
buffer.remaining());
|
||||
|
||||
if (c > 0) {
|
||||
buffer.position(buffer.position() + c);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public int read() throws IOException {
|
||||
char[] buffer = new char[1];
|
||||
int c = read(buffer);
|
||||
|
Reference in New Issue
Block a user