···25252626You can use `writeU16Big`, `writeU32Big`, `writeU64Big` and `writeU16Little`, `writeU32Little`, `writeU64Little` to write integer values.
27272828+## Views
2929+A common pattern is to include a 2 or 4 byte payload length prefix to messages. However, this length might not until after the message is generated. The `skip` and `view` functions exist specifically to solve the problem - but they must be used carefully:
3030+3131+```zig
3232+var buf = try Buffer.init(allocator, 100);
3333+3434+// reserve 4 bytes for our length
3535+var start = buf.skip(4);
3636+try buf.write("hello world");
3737+try buf.writeByte('!');
3838+3939+var view = buf.view(start);
4040+// -4 since most protocols don't include the 4 byte length in the length itself
4141+view.writeU32Little(@intCast(buf.len() - 4);
4242+```
4343+4444+The `view` exposes most of the same methods as the Buffer, but cannot grow and does not perform bound checking. Furthermore, interlacing writes to the view and the buffer can segfault. You can safely write to the buffer after you're done writing to the view.
4545+4646+For example, the following can segfault:
4747+4848+```zig
4949+var buf = try Buffer.init(allocator, 100);
5050+5151+// reserve 4 bytes for our length
5252+var start = buf.skip(4);
5353+try buf.write("hello world");
5454+5555+var view = buf.view(start);
5656+try buf.writeByte('!');
5757+// view might not be valid as we've since written to buf
5858+view.writeU32Little(@intCast(buf.len() - 4);
5959+```
6060+2861## Pooling
29623063```zig