# BitStreamFormatter Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/)

## Format(BufferSlice, SerializerSession) {#format-orleans-serialization-buffers-pooledbuffer-bufferslice-orleans-serializat-74c774f2}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/methods/format-orleans-serialization-buffers-pooledbuffer-bufferslice-orleans-serializat-74c774f2/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Utilities/BitStreamFormatter.cs#L38-L39)

```csharp
public static string Format(BufferSlice slice, SerializerSession session)
```

Formats the specified array.

### Parameters

- `slice` (`BufferSlice`): The array.
- `session` (`SerializerSession`): The session.

### Returns

The formatted input.

## Format(ReadOnlyMemory&lt;byte&gt;, SerializerSession) {#format-system-readonlymemory-byte-orleans-serialization-session-serializersessio-4bebe157}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/methods/format-system-readonlymemory-byte-orleans-serialization-session-serializersessio-4bebe157/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Utilities/BitStreamFormatter.cs)

```csharp
public static string Format(ReadOnlyMemory<byte> input, SerializerSession session)
```

Formats the specified buffer.

### Parameters

- `input` (`ReadOnlyMemory<byte>`): The input buffer.
- `session` (`SerializerSession`): The session.

### Returns

The formatted input.

## Format(ReadOnlySequence&lt;byte&gt;, SerializerSession) {#format-system-buffers-readonlysequence-byte-orleans-serialization-session-serial-eef102a1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/methods/format-system-buffers-readonlysequence-byte-orleans-serialization-session-serial-eef102a1/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Utilities/BitStreamFormatter.cs)

```csharp
public static string Format(ReadOnlySequence<byte> input, SerializerSession session)
```

Formats the specified buffer.

### Parameters

- `input` (`ReadOnlySequence<byte>`): The input buffer.
- `session` (`SerializerSession`): The session.

### Returns

The formatted input.

## Format(ReadOnlySpan&lt;byte&gt;, SerializerSession) {#format-system-readonlyspan-byte-orleans-serialization-session-serializersession-4c162bd4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/methods/format-system-readonlyspan-byte-orleans-serialization-session-serializersession-4c162bd4/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Utilities/BitStreamFormatter.cs)

```csharp
public static string Format(ReadOnlySpan<byte> input, SerializerSession session)
```

Formats the specified buffer.

### Parameters

- `input` (`ReadOnlySpan<byte>`): The input buffer.
- `session` (`SerializerSession`): The session.

### Returns

The formatted input.

## Format(Stream, SerializerSession) {#format-system-io-stream-orleans-serialization-session-serializersession-f2162a52}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/methods/format-system-io-stream-orleans-serialization-session-serializersession-f2162a52/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Utilities/BitStreamFormatter.cs)

```csharp
public static string Format(Stream input, SerializerSession session)
```

Formats the specified buffer.

### Parameters

- `input` (`Stream`): The input buffer.
- `session` (`SerializerSession`): The session.

### Returns

The formatted input.

## Format(byte[], SerializerSession) {#format-byte-array-1-orleans-serialization-session-serializersession-08ae349d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/methods/format-byte-array-1-orleans-serialization-session-serializersession-08ae349d/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Utilities/BitStreamFormatter.cs#L50-L51)

```csharp
public static string Format(byte[] array, SerializerSession session)
```

Formats the specified array.

### Parameters

- `array` (`byte[]`): The array.
- `session` (`SerializerSession`): The session.

### Returns

The formatted input.

## Format(Reader&lt;TInput&gt;) {#format-1-ref-orleans-serialization-buffers-reader-tinput-e570081f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/methods/format-1-ref-orleans-serialization-buffers-reader-tinput-e570081f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Utilities/BitStreamFormatter.cs#L25-L27)

```csharp
public static string Format<TInput>(ref Reader<TInput> reader)
```

Formats the provided buffer.

### Parameters

- `reader` (`Reader<TInput>`): The reader.

### Returns

The formatted input.

## Format(Reader&lt;TInput&gt;, StringBuilder) {#format-1-ref-orleans-serialization-buffers-reader-tinput-system-text-stringbuild-a604fbbd}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.utilities.bitstreamformatter/methods/format-1-ref-orleans-serialization-buffers-reader-tinput-system-text-stringbuild-a604fbbd/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Utilities/BitStreamFormatter.cs#L110-L112)

```csharp
public static void Format<TInput>(ref Reader<TInput> reader, StringBuilder result)
```

Formats the specified buffer.

### Parameters

- `reader` (`Reader<TInput>`): The reader.
- `result` (`StringBuilder`): The destination string builder.
