# JournalBufferWriter Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/)

## CreateJournalStreamWriter(JournalStreamId) {#createjournalstreamwriter-orleans-durable-journaling-journalstreamid-d8e83036}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/createjournalstreamwriter-orleans-durable-journaling-journalstreamid-d8e83036/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalBufferWriter.cs#L32)

```csharp
public JournalStreamWriter CreateJournalStreamWriter(JournalStreamId streamId)
```

Creates a writer for entries belonging to `streamId`.

### Parameters

- `streamId` (`JournalStreamId`): The durable state id.

### Returns

A journal stream writer for the specified state.

## Dispose {#dispose-28fa9508}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/dispose-28fa9508/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalBufferWriter.cs#L66-L77)

```csharp
public void Dispose()
```

Releases resources used by this writer.

## FinishEntry(JournalStreamId) {#finishentry-orleans-durable-journaling-journalstreamid-bbd9c12a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/finishentry-orleans-durable-journaling-journalstreamid-bbd9c12a/)

```csharp
protected abstract void FinishEntry(JournalStreamId streamId)
```

Writes any format-owned entry suffix or patches framing bytes.

### Parameters

- `streamId` (`JournalStreamId`): The durable state id.

## GetBuffer {#getbuffer-95f722b3}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/getbuffer-95f722b3/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalBufferWriter.cs#L45)

```csharp
public ArcBuffer GetBuffer()
```

Gets a pinned snapshot of the accumulated journal bytes which are safe to persist.

### Returns

An [ArcBuffer](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.arcbuffer/) containing the accumulated journal bytes. The caller owns and must dispose the returned buffer.

## GetEntryByte(int) {#getentrybyte-int-e620e4fa}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/getentrybyte-int-e620e4fa/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalBufferWriter.cs#L131-L144)

```csharp
protected byte GetEntryByte(int offset)
```

Gets a byte at the specified offset in the active entry.

### Parameters

- `offset` (`int`): The offset into the active entry.

## Reset {#reset-0c0aff32}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/reset-0c0aff32/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalBufferWriter.cs#L52-L60)

```csharp
public void Reset()
```

Clears all buffered data so the writer can be reused for another batch.

## StartEntry(JournalStreamId) {#startentry-orleans-durable-journaling-journalstreamid-e6318a4a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/startentry-orleans-durable-journaling-journalstreamid-e6318a4a/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalBufferWriter.cs#L152)

```csharp
protected virtual void StartEntry(JournalStreamId streamId)
```

Writes any format-owned entry prefix and prepares the payload writer.

### Parameters

- `streamId` (`JournalStreamId`): The durable state id.

## WriteAt(int, ReadOnlySpan&lt;byte&gt;) {#writeat-int-system-readonlyspan-byte-1c2288b1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/writeat-int-system-readonlyspan-byte-1c2288b1/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalBufferWriter.cs#L106-L124)

```csharp
protected void WriteAt(int offset, ReadOnlySpan<byte> value)
```

Patches format-owned framing bytes at the specified offset in the active entry.

### Parameters

- `offset` (`int`): The offset into the active entry.
- `value` (`ReadOnlySpan<byte>`): The replacement bytes.

## WritePreservedEntry(JournalStreamId, IPreservedJournalEntry) {#writepreservedentry-orleans-durable-journaling-journalstreamid-orleans-durable-j-0a594f59}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.journaling.journalbufferwriter/methods/writepreservedentry-orleans-durable-journaling-journalstreamid-orleans-durable-j-0a594f59/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Journaling/JournalBufferWriter.cs#L167-L168)

```csharp
protected virtual void WritePreservedEntry(JournalStreamId streamId, IPreservedJournalEntry entry)
```

Appends a format-owned entry for retired or unknown state preservation.

### Parameters

- `streamId` (`JournalStreamId`): The durable state id.
- `entry` (`IPreservedJournalEntry`): The preserved entry.
