Ejemplo n.º 1
0
 private Buffer setBytes(int pos, String str, Charset charset) {
   byte[] bytes = str.getBytes(charset);
   ensureWritable(pos, bytes.length);
   buffer.setBytes(pos, bytes);
   return this;
 }
Ejemplo n.º 2
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 setBytes(int pos, ByteBuffer b) {
   ensureWritable(pos, b.limit());
   buffer.setBytes(pos, b);
   return this;
 }
Ejemplo n.º 3
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 setBytes(int pos, byte[] b) {
   ensureWritable(pos, b.length);
   buffer.setBytes(pos, b);
   return this;
 }
Ejemplo n.º 4
0
 /**
  * Sets the {@code short} at position {@code pos} in the Buffer to the value {@code i}.
  *
  * <p>The buffer will expand as necessary to accomodate any value written.
  */
 public Buffer setShort(int pos, short s) {
   ensureWritable(pos, 2);
   buffer.setShort(pos, s);
   return this;
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
0
 /**
  * Sets the {@code float} at position {@code pos} in the Buffer to the value {@code i}.
  *
  * <p>The buffer will expand as necessary to accomodate any value written.
  */
 public Buffer setFloat(int pos, float f) {
   ensureWritable(pos, 4);
   buffer.setFloat(pos, f);
   return this;
 }
Ejemplo n.º 7
0
 /**
  * Sets the {@code double} at position {@code pos} in the Buffer to the value {@code i}.
  *
  * <p>The buffer will expand as necessary to accomodate any value written.
  */
 public Buffer setDouble(int pos, double d) {
   ensureWritable(pos, 8);
   buffer.setDouble(pos, d);
   return this;
 }
Ejemplo n.º 8
0
 /**
  * Sets the {@code long} at position {@code pos} in the Buffer to the value {@code i}.
  *
  * <p>The buffer will expand as necessary to accomodate any value written.
  */
 public Buffer setLong(int pos, long l) {
   ensureWritable(pos, 8);
   buffer.setLong(pos, l);
   return this;
 }
Ejemplo n.º 9
0
 /**
  * Sets the {@code int} at position {@code pos} in the Buffer to the value {@code i}.
  *
  * <p>The buffer will expand as necessary to accomodate any value written.
  */
 public Buffer setInt(int pos, int i) {
   ensureWritable(pos, 4);
   buffer.setInt(pos, i);
   return this;
 }
Ejemplo n.º 10
0
 /**
  * Sets the {@code byte} 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 setByte(int pos, byte b) {
   ensureWritable(pos, 1);
   buffer.setByte(pos, b);
   return this;
 }