int nBytes = -1;
ByteBuffer bb = ByteBuffer.allocate(Net.bufSize);
nBytes = socketChannel.read(bb);
Different.message("Accepting nBytes: " + nBytes);
Different.message(new String(bb.array(), 0, nBytes));
Different.message("Accepting clientData.len: " + clientData.len);
bb.get(buf, len, nBytes);
Different.message("Accepting buf: " + new String(buf, 0, nBytes));
for (int j=0; j<10; j++)
Different.message("buf[" + j + "]: " + buf[j] + "\n");
Куда символы пропадают ?
Код:
Accepting nBytes: 37
POST / HTTP/1.0
?
Accepting len: 0
Accepting buf: ?????????????????????????
buf[0]: 0
buf[1]: 0
buf[2]: 0
...
Из кода не видно, но исспользование странное.
int len = 0;
ByteBuffer bb = ByteBuffer.allocate(Net.bufSize);
nBytes = socketChannel.read(bb);
Different.message("Accepting nBytes: " + nBytes);
Different.message(new String(bb.array(), 0, nBytes));
Different.message("Accepting len: " + len);
bb.get(buf, len, nBytes);
Different.message("Accepting buf: " + new String(buf, 0, nBytes));
for (int j=0; j<10; j++)
Different.message("buf[" + j + "]: " + buf[j] + "\n");
System.arraycopy(bb.array(), 0, buf, len, nBytes);