Ejemplo n.º 1
0
 /**
  * Appends the specified {@code Buffer} to the end of the Buffer. The buffer will expand as
  * necessary to accomodate any bytes written.
  *
  * <p>Returns a reference to {@code this} so multiple operations can be appended together.
  */
 public Buffer appendBuffer(Buffer buff) {
   ChannelBuffer cb = buff.getChannelBuffer();
   buffer.writeBytes(buff.getChannelBuffer());
   cb.readerIndex(
       0); // Need to reset readerindex since Netty write modifies readerIndex of source!
   return this;
 }
Ejemplo n.º 2
0
 /**
  * Write a {@link Buffer} to the request body. The {@code doneHandler} is called after the buffer
  * is actually written to the wire.
  *
  * <p>
  *
  * @return A reference to this, so multiple method calls can be chained.
  */
 public HttpClientRequest write(Buffer chunk, Handler<Void> doneHandler) {
   check();
   return write(chunk.getChannelBuffer(), doneHandler);
 }
Ejemplo n.º 3
0
 /**
  * Write a {@link Buffer} to the request body.
  *
  * <p>
  *
  * @return A reference to this, so multiple method calls can be chained.
  */
 public HttpClientRequest write(Buffer chunk) {
   check();
   return write(chunk.getChannelBuffer(), null);
 }
Ejemplo n.º 4
0
 /** Write a {@link Buffer} to the request body. */
 public void writeBuffer(Buffer chunk) {
   check();
   write(chunk.getChannelBuffer(), null);
 }
Ejemplo n.º 5
0
 public void write(Buffer buffer, int position, AsyncResultHandler<Void> handler) {
   check();
   ByteBuffer bb = buffer.getChannelBuffer().toByteBuffer();
   doWrite(bb, position, handler);
 }
Ejemplo n.º 6
0
 /**
  * Sets the bytes at position {@code pos} in the Buffer to the value {@code b}.
  *
  * <p>The buffer will expand as necessary to accomodate any value written.
  */
 public Buffer setBuffer(int pos, Buffer b) {
   ensureWritable(pos, b.length());
   buffer.setBytes(pos, b.getChannelBuffer());
   return this;
 }