# 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:
  - vertx-js/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:
  - vertx-js/buffer.js, line 381

##### 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:
  - vertx-js/buffer.js, line 400

##### 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:
  - vertx-js/buffer.js, line 640

##### 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:
  - vertx-js/buffer.js, line 624

##### 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:
  - vertx-js/buffer.js, line 432

##### Returns:

Type
  Buffer

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

Appends the specified `int` to the end of the Buffer in the Little Endian Byte Order. 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:
  - vertx-js/buffer.js, line 448

##### 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:
  - vertx-js/buffer.js, line 528

##### Returns:

Type
  Buffer

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

Appends the specified `long` to the end of the Buffer in the Little Endian Byte Order. 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:
  - vertx-js/buffer.js, line 544

##### Returns:

Type
  Buffer

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

Appends the specified 24bit `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:
  - vertx-js/buffer.js, line 496

##### Returns:

Type
  Buffer

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

Appends the specified 24bit `int` to the end of the Buffer in the Little Endian Byte Order. 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:
  - vertx-js/buffer.js, line 512

##### 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:
  - vertx-js/buffer.js, line 560

##### Returns:

Type
  Buffer

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

Appends the specified `short` to the end of the Buffer in the Little Endian Byte Order.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:
  - vertx-js/buffer.js, line 576

##### 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:
  - vertx-js/buffer.js, line 658

##### Returns:

Type
  Buffer

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

Appends the specified unsigned `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:
  - vertx-js/buffer.js, line 416

##### Returns:

Type
  Buffer

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

Appends the specified unsigned `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:
  - vertx-js/buffer.js, line 464

##### Returns:

Type
  Buffer

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

Appends the specified unsigned `int` to the end of the Buffer in the Little Endian Byte Order. 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:
  - vertx-js/buffer.js, line 480

##### Returns:

Type
  Buffer

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

Appends the specified unsigned `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:
  - vertx-js/buffer.js, line 592

##### Returns:

Type
  Buffer

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

Appends the specified unsigned `short` to the end of the Buffer in the Little Endian Byte Order.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:
  - vertx-js/buffer.js, line 608

##### Returns:

Type
  Buffer

#### copy() → {Buffer}

Returns a copy of the entire Buffer.

Source:
  - vertx-js/buffer.js, line 1006

##### 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:
  - vertx-js/buffer.js, line 344

##### Returns:

Type
  Buffer

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

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 90

##### Returns:

Type
  number

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

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 202

##### Returns:

Type
  number

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

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 216

##### Returns:

Type
  number

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

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 118

##### Returns:

Type
  number

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

Gets a 32-bit integer at the specified absolute `index` in this buffer with Little Endian Byte Order.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 132

##### Returns:

Type
  number

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

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 174

##### Returns:

Type
  number

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

Gets a 64-bit long integer at the specified absolute `index` in this buffer in Little Endian Byte Order.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 188

##### Returns:

Type
  number

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

Gets a 24-bit medium integer at the specified absolute `index` in this buffer.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 286

##### Returns:

Type
  number

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

Gets a 24-bit medium integer at the specified absolute `index` in this buffer in the Little Endian Byte Order.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 300

##### Returns:

Type
  number

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

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 230

##### Returns:

Type
  number

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

Gets a 16-bit short integer at the specified absolute `index` in this buffer in Little Endian Byte Order.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 244

##### 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:
  - vertx-js/buffer.js, line 361

##### Returns:

Type
  string

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

Returns the unsigned `byte` at position `pos` in the Buffer, as a `short`.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 104

##### Returns:

Type
  number

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

Returns the unsigned `int` at position `pos` in the Buffer, as a `long`.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 146

##### Returns:

Type
  number

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

Returns the unsigned `int` at position `pos` in the Buffer, as a `long` in Little Endian Byte Order.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 160

##### Returns:

Type
  number

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

Gets an unsigned 24-bit medium integer at the specified absolute `index` in this buffer.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 314

##### Returns:

Type
  number

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

Gets an unsigned 24-bit medium integer at the specified absolute `index` in this buffer in Little Endian Byte Order.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 328

##### Returns:

Type
  number

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

Returns the unsigned `short` at position `pos` in the Buffer, as an `int`.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 258

##### Returns:

Type
  number

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

Gets an unsigned 16-bit short integer at the specified absolute `index` in this buffer in Little Endian Byte Order.

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 272

##### Returns:

Type
  number

#### length() → {number}

Returns the length of the buffer, measured in bytes. All positions are indexed from zero.

Source:
  - vertx-js/buffer.js, line 992

##### 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:
  - vertx-js/buffer.js, line 952

##### 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:
  - vertx-js/buffer.js, line 678

##### 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:
  - vertx-js/buffer.js, line 848

##### 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:
  - vertx-js/buffer.js, line 865

##### 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:
  - vertx-js/buffer.js, line 712

##### Returns:

Type
  Buffer

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

Sets the `int` at position `pos` in the Buffer to the value `i` in the Little Endian Byte Order.

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 729

##### 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:
  - vertx-js/buffer.js, line 814

##### Returns:

Type
  Buffer

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

Sets the `long` at position `pos` in the Buffer to the value `l` in the Little Endian Byte Order.

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 831

##### Returns:

Type
  Buffer

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

Sets the 24bit `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:
  - vertx-js/buffer.js, line 780

##### Returns:

Type
  Buffer

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

Sets the 24bit `int` at position `pos` in the Buffer to the value `i`. in the Little Endian Byte Order

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 797

##### 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:
  - vertx-js/buffer.js, line 882

##### Returns:

Type
  Buffer

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

Sets the `short` at position `pos` in the Buffer to the value `s` in the Little Endian Byte Order.

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 899

##### 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:
  - vertx-js/buffer.js, line 973

##### Returns:

Type
  Buffer

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

Sets the unsigned `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:
  - vertx-js/buffer.js, line 695

##### Returns:

Type
  Buffer

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

Sets the unsigned `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:
  - vertx-js/buffer.js, line 746

##### Returns:

Type
  Buffer

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

Sets the unsigned `int` at position `pos` in the Buffer to the value `i` in the Little Endian Byte Order.

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 763

##### Returns:

Type
  Buffer

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

Sets the unsigned `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:
  - vertx-js/buffer.js, line 916

##### Returns:

Type
  Buffer

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

Sets the unsigned `short` at position `pos` in the Buffer to the value `s` in the Little Endian Byte Order.

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 933

##### 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:
  - vertx-js/buffer.js, line 1023

##### Returns:

Type
  Buffer

#### toJsonArray() → {todo}

Returns a Json array representation of the Buffer

Source:
  - vertx-js/buffer.js, line 76

##### Returns:

Type
  todo

#### toJsonObject() → {Object}

Returns a Json object representation of the Buffer

Source:
  - vertx-js/buffer.js, line 62

##### Returns:

Type
  Object

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

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

##### Parameters:

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

Source:
  - vertx-js/buffer.js, line 46

##### Returns:

Type
  string