MCPcopy Create free account
hub / github.com/ReadyTalk/avian / read

Method read

classpath/java/nio/channels/SocketChannel.java:107–119  ·  view source on GitHub ↗
(ByteBuffer b)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 6

natReadMethod · 0.95
isOpenMethod · 0.65
remainingMethod · 0.45
arrayMethod · 0.45
arrayOffsetMethod · 0.45
positionMethod · 0.45

Tested by

no test coverage detected