public JniStream(byte[] buf, OutputStream out) { // the first byte is reserved // the next byte is for the end/continue writetype // the next 2 bytes is the end offset (int16) // the next 2 bytes is the length of the buffer (int16) // the next three 8s are for the ptrs: db, writebatch, iterator // the next 4 bytes is state written by native code // the last 4 bytes is for kvao super(LinkedBuffer.use(buf, OFFSET_START), out); // write the buf len IntSerializer.writeInt16LE(buf.length, buf, OFFSET_BUFLEN); }
public RpcWorker(int id, byte[] buf, RpcServer server, WriteContext context) { this.id = id; this.buf = buf; // start at 5 // 0xFF 0xFF [ 0 , this.session = new WriteSession(LinkedBuffer.use(buf, 5)); this.server = server; this.context = context; kvpInput = new KvpTextByteArrayInput(buf, 0, 0); jniCodecs = ProtocolSpecificCodecs.create(RpcProtocol.DEFAULT, this, session, session.nextBufferSize); //protocolDelegate = null; }