private byte[] ReadByteBuf(IoBuffer buf) { if (buf == null) { return null; } return buf.GetRemainingArray(); }