# Class: Buffer

## vertx-js/buffer~ Buffer

#### new Buffer()

  Most data is shuffled around inside Vert.x using buffers.

  A buffer is a sequence of zero or more bytes that can read from or written to and which expands automatically as necessary to accommodate any bytes written to it. You can perhaps think of a buffer as smart byte array.

  Please consult the documentation for more information on buffers.

  Source:
    - buffer.js, line 34

### Methods

#### appendBuffer(buff, offset, len) → {Buffer}

  Appends the specified `Buffer` starting at the `offset` using `len` to the end of this Buffer. The buffer will expand as necessary to accommodate any bytes written.

  Returns a reference to `this` so multiple operations can be appended together.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `buff` | Buffer |
  `offset` | number |
  `len` | number |

  Source:
    - buffer.js, line 183

  ##### Returns:

  Type
    Buffer

#### appendByte(b) → {Buffer}

  Appends the specified `byte` to the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.

  Returns a reference to `this` so multiple operations can be appended together.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `b` | number |

  Source:
    - buffer.js, line 202

  ##### Returns:

  Type
    Buffer

#### appendDouble(d) → {Buffer}

  Appends the specified `double` to the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.

  Returns a reference to `this` so multiple operations can be appended together.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `d` | number |

  Source:
    - buffer.js, line 282

  ##### Returns:

  Type
    Buffer

#### appendFloat(f) → {Buffer}

  Appends the specified `float` to the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.

  Returns a reference to `this` so multiple operations can be appended together.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `f` | number |

  Source:
    - buffer.js, line 266

  ##### Returns:

  Type
    Buffer

#### appendInt(i) → {Buffer}

  Appends the specified `int` to the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.

  Returns a reference to `this` so multiple operations can be appended together.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `i` | number |

  Source:
    - buffer.js, line 218

  ##### Returns:

  Type
    Buffer

#### appendLong(l) → {Buffer}

  Appends the specified `long` to the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.

  Returns a reference to `this` so multiple operations can be appended together.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `l` | number |

  Source:
    - buffer.js, line 234

  ##### Returns:

  Type
    Buffer

#### appendShort(s) → {Buffer}

  Appends the specified `short` to the end of the Buffer.The buffer will expand as necessary to accommodate any bytes written.

  Returns a reference to `this` so multiple operations can be appended together.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `s` | number |

  Source:
    - buffer.js, line 250

  ##### Returns:

  Type
    Buffer

#### appendString(str, enc) → {Buffer}

  Appends the specified `String` to the end of the Buffer with the encoding as specified by `enc`.

  The buffer will expand as necessary to accommodate any bytes written.

  Returns a reference to `this` so multiple operations can be appended together.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `str` | string |
  `enc` | string |

  Source:
    - buffer.js, line 300

  ##### Returns:

  Type
    Buffer

#### copy() → {Buffer}

  Returns a copy of the entire Buffer.
  Source:
    - buffer.js, line 478

  ##### Returns:

  Type
    Buffer

#### getBuffer(start, end) → {Buffer}

  Returns a copy of a sub-sequence the Buffer as a Buffer starting at position `start` and ending at position `end - 1`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `start` | number |
  `end` | number |

  Source:
    - buffer.js, line 146

  ##### Returns:

  Type
    Buffer

#### getByte(pos) → {number}

  Returns the `byte` at position `pos` in the Buffer.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |

  Source:
    - buffer.js, line 60

  ##### Returns:

  Type
    number

#### getDouble(pos) → {number}

  Returns the `double` at position `pos` in the Buffer.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |

  Source:
    - buffer.js, line 102

  ##### Returns:

  Type
    number

#### getFloat(pos) → {number}

  Returns the `float` at position `pos` in the Buffer.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |

  Source:
    - buffer.js, line 116

  ##### Returns:

  Type
    number

#### getInt(pos) → {number}

  Returns the `int` at position `pos` in the Buffer.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |

  Source:
    - buffer.js, line 74

  ##### Returns:

  Type
    number

#### getLong(pos) → {number}

  Returns the `long` at position `pos` in the Buffer.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |

  Source:
    - buffer.js, line 88

  ##### Returns:

  Type
    number

#### getShort(pos) → {number}

  Returns the `short` at position `pos` in the Buffer.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |

  Source:
    - buffer.js, line 130

  ##### Returns:

  Type
    number

#### getString(start, end, enc) → {string}

  Returns a copy of a sub-sequence the Buffer as a `String` starting at position `start` and ending at position `end - 1` interpreted as a String in the specified encoding

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `start` | number |
  `end` | number |
  `enc` | string |

  Source:
    - buffer.js, line 163

  ##### Returns:

  Type
    string

#### length() → {number}

  Returns the length of the buffer, measured in bytes. All positions are indexed from zero.
  Source:
    - buffer.js, line 464

  ##### Returns:

  Type
    number

#### setBuffer(pos, b, offset, len) → {Buffer}

  Sets the bytes at position `pos` in the Buffer to the bytes represented by the `Buffer b` on the given `offset` and `len`.

  The buffer will expand as necessary to accommodate any value written.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |
  `b` | Buffer |
  `offset` | number |
  `len` | number |

  Source:
    - buffer.js, line 424

  ##### Returns:

  Type
    Buffer

#### setByte(pos, b) → {Buffer}

  Sets the `byte` at position `pos` in the Buffer to the value `b`.

  The buffer will expand as necessary to accommodate any value written.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |
  `b` | number |

  Source:
    - buffer.js, line 320

  ##### Returns:

  Type
    Buffer

#### setDouble(pos, d) → {Buffer}

  Sets the `double` at position `pos` in the Buffer to the value `d`.

  The buffer will expand as necessary to accommodate any value written.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |
  `d` | number |

  Source:
    - buffer.js, line 371

  ##### Returns:

  Type
    Buffer

#### setFloat(pos, f) → {Buffer}

  Sets the `float` at position `pos` in the Buffer to the value `f`.

  The buffer will expand as necessary to accommodate any value written.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |
  `f` | number |

  Source:
    - buffer.js, line 388

  ##### Returns:

  Type
    Buffer

#### setInt(pos, i) → {Buffer}

  Sets the `int` at position `pos` in the Buffer to the value `i`.

  The buffer will expand as necessary to accommodate any value written.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |
  `i` | number |

  Source:
    - buffer.js, line 337

  ##### Returns:

  Type
    Buffer

#### setLong(pos, l) → {Buffer}

  Sets the `long` at position `pos` in the Buffer to the value `l`.

  The buffer will expand as necessary to accommodate any value written.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |
  `l` | number |

  Source:
    - buffer.js, line 354

  ##### Returns:

  Type
    Buffer

#### setShort(pos, s) → {Buffer}

  Sets the `short` at position `pos` in the Buffer to the value `s`.

  The buffer will expand as necessary to accommodate any value written.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |
  `s` | number |

  Source:
    - buffer.js, line 405

  ##### Returns:

  Type
    Buffer

#### setString(pos, str, enc) → {Buffer}

  Sets the bytes at position `pos` in the Buffer to the value of `str` encoded in encoding `enc`.

  The buffer will expand as necessary to accommodate any value written.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number |
  `str` | string |
  `enc` | string |

  Source:
    - buffer.js, line 445

  ##### Returns:

  Type
    Buffer

#### slice(start, end) → {Buffer}

  Returns a slice of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `start` | number |
  `end` | number |

  Source:
    - buffer.js, line 495

  ##### Returns:

  Type
    Buffer

#### toString(enc) → {string}

  Returns a `String` representation of the Buffer with the encoding specified by `enc`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `enc` | string |

  Source:
    - buffer.js, line 46

  ##### Returns:

  Type
    string