public static int read(ReadableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException { do { int n = channel.read(buf); if (n != 0 || !blocking || !(channel instanceof SelectableChannel) || !buf.hasRemaining()) { return n; } try { awaitReadable(channel); } catch (InterruptedException ex) { throw new InterruptedIOException(ex.getMessage()); } } while (true); } public static int write(WritableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException {
public static int read(ReadableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException { do { int n = channel.read(buf); if (n != 0 || !blocking || !(channel instanceof SelectableChannel) || !buf.hasRemaining()) { return n; } try { awaitReadable(channel); } catch (InterruptedException ex) { throw new InterruptedIOException(ex.getMessage()); } } while (true); } public static int write(WritableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException {
public static int read(ReadableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException { do { int n = channel.read(buf); if (n != 0 || !blocking || !(channel instanceof SelectableChannel) || !buf.hasRemaining()) { return n; } try { awaitReadable(channel); } catch (InterruptedException ex) { throw new InterruptedIOException(ex.getMessage()); } } while (true); } public static int write(WritableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException {
public static int read(ReadableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException { do { int n = channel.read(buf); if (n != 0 || !blocking || !(channel instanceof SelectableChannel) || !buf.hasRemaining()) { return n; } try { awaitReadable(channel); } catch (InterruptedException ex) { throw new InterruptedIOException(ex.getMessage()); } } while (true); } public static int write(WritableByteChannel channel, ByteBuffer buf, boolean blocking) throws IOException {