# ArcBufferReader Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/)

## Consume(Span&lt;byte&gt;) {#consume-system-span-byte-c5d74cc1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/methods/consume-system-span-byte-c5d74cc1/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1184-L1191)

```csharp
public void Consume(Span<byte> output)
```

Consumes the amount of data present in the span.

### Parameters

- `output` (`Span<byte>`)

## ConsumeSlice(int) {#consumeslice-int-b2052a2c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/methods/consumeslice-int-b2052a2c/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1120)

```csharp
public ArcBuffer ConsumeSlice(int count)
```

Consumes a slice of the provided length.

### Parameters

- `count` (`int`): The number of bytes to consume.

### Returns

A pinned buffer representing the consumed data. The caller owns the returned buffer and must dispose it.

## IsNext(ReadOnlySpan&lt;byte&gt;, bool) {#isnext-system-readonlyspan-byte-bool-3a055c8c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/methods/isnext-system-readonlyspan-byte-bool-3a055c8c/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1157-L1175)

```csharp
public bool IsNext(ReadOnlySpan<byte> next, bool advancePast = false)
```

Checks whether the next bytes match `next`.

### Parameters

- `next` (`ReadOnlySpan<byte>`): The bytes to compare to the next bytes.
- `advancePast` (`bool`): Whether to advance past the bytes if they match.

### Returns

`true` if the next bytes match; otherwise, `false`.

## Peek(Span&lt;byte&gt;) {#peek-in-system-span-byte-dd7dded4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/methods/peek-in-system-span-byte-dd7dded4/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1084)

```csharp
public ReadOnlySpan<byte> Peek(scoped in Span<byte> destination)
```

Attempts to read the provided number of bytes from the buffer.

### Parameters

- `destination` (`Span<byte>`): The destination, which may be used to hold the requested data if the data needs to be copied.

### Returns

A span of either zero length, if the data is unavailable, or the requested length if the data is available.

## Peek(long) {#peek-long-77cf47dc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/methods/peek-long-77cf47dc/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1094-L1099)

```csharp
public byte Peek(long offset)
```

Peeks at a byte at the specified offset into the unread data.

### Parameters

- `offset` (`long`): The offset into the unread data.

### Returns

The byte at the specified offset.

## PeekSlice(int) {#peekslice-int-09d285f7}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/methods/peekslice-int-09d285f7/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1110)

```csharp
public ArcBuffer PeekSlice(int count)
```

Returns a pinned slice of the provided length without marking the data referred to it as consumed.

### Parameters

- `count` (`int`): The number of bytes to consume.

### Returns

A pinned slice of unconsumed data. The caller owns the returned buffer and must dispose it.

## Skip(int) {#skip-int-3c56e5b1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/methods/skip-int-3c56e5b1/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1199-L1200)

```csharp
public void Skip(int count)
```

Advances the reader by the specified number of bytes.

### Parameters

- `count` (`int`): The number of bytes to advance.

## TryReadTo(ArcBuffer, byte, bool) {#tryreadto-out-orleans-serialization-buffers-arcbuffer-byte-bool-85941dc7}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbufferreader/methods/tryreadto-out-orleans-serialization-buffers-arcbuffer-byte-bool-85941dc7/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/ArcBufferWriter.cs#L1133-L1146)

```csharp
public bool TryReadTo(out ArcBuffer slice, byte delimiter, bool advancePastDelimiter = true)
```

Reads bytes until `delimiter` is found.

### Parameters

- `slice` (`ArcBuffer`): The pinned bytes before the delimiter, if it was found. The caller owns the returned buffer and must dispose it.
- `delimiter` (`byte`): The delimiter to search for.
- `advancePastDelimiter` (`bool`): Whether to advance past the delimiter when it is found.

### Returns

`true` if the delimiter was found; otherwise, `false`.
