Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Watson committed Nov 29, 2023
1 parent df7da49 commit 407ddc3
Show file tree
Hide file tree
Showing 75 changed files with 561 additions and 655 deletions.
8 changes: 4 additions & 4 deletions docs/Microsoft.IO/RecyclableMemoryStream.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed class RecyclableMemoryStream : MemoryStream, IBufferWriter<byte>

| name | description |
| --- | --- |
| [RecyclableMemoryStream](RecyclableMemoryStream/RecyclableMemoryStream.md)(…) | Initializes a new instance of the [`RecyclableMemoryStream`](./RecyclableMemoryStream.md) class. (8 constructors) |
| [RecyclableMemoryStream](RecyclableMemoryStream/RecyclableMemoryStream.md)(…) | Initializes a new instance of the [`RecyclableMemoryStream`](./RecyclableMemoryStream.md) class. (6 constructors) |
| override [CanRead](RecyclableMemoryStream/CanRead.md) { get; } | Whether the stream can currently read. |
| override [CanSeek](RecyclableMemoryStream/CanSeek.md) { get; } | Whether the stream can currently seek. |
| override [CanTimeout](RecyclableMemoryStream/CanTimeout.md) { get; } | Always false. |
Expand All @@ -29,8 +29,8 @@ public sealed class RecyclableMemoryStream : MemoryStream, IBufferWriter<byte>
| [GetSpan](RecyclableMemoryStream/GetSpan.md)(…) | |
| override [Read](RecyclableMemoryStream/Read.md)(…) | Reads from the current position into the provided buffer. (2 methods) |
| override [ReadByte](RecyclableMemoryStream/ReadByte.md)() | Reads a single byte from the current position in the stream. |
| [SafeRead](RecyclableMemoryStream/SafeRead.md)(…) | Reads from the specified position into the provided buffer. (4 methods) |
| [SafeReadByte](RecyclableMemoryStream/SafeReadByte.md)(…) | Reads a single byte from the specified position in the stream. (2 methods) |
| [SafeRead](RecyclableMemoryStream/SafeRead.md)(…) | Reads from the specified position into the provided buffer. (2 methods) |
| [SafeReadByte](RecyclableMemoryStream/SafeReadByte.md)(…) | Reads a single byte from the specified position in the stream. |
| override [Seek](RecyclableMemoryStream/Seek.md)(…) | Sets the position to the offset from the seek location. |
| override [SetLength](RecyclableMemoryStream/SetLength.md)(…) | Sets the length of the stream. |
| override [ToArray](RecyclableMemoryStream/ToArray.md)() | Returns a new array with a copy of the buffer's contents. You should almost certainly be using [`GetBuffer`](./RecyclableMemoryStream/GetBuffer.md) combined with the [`Length`](./RecyclableMemoryStream/Length.md) to access the bytes in this stream. Calling `ToArray` will destroy the benefits of pooled buffers, but it is included for the sake of completeness. |
Expand All @@ -39,7 +39,7 @@ public sealed class RecyclableMemoryStream : MemoryStream, IBufferWriter<byte>
| override [Write](RecyclableMemoryStream/Write.md)(…) | Writes the buffer to the stream. (2 methods) |
| override [WriteByte](RecyclableMemoryStream/WriteByte.md)(…) | Writes a single byte to the current position in the stream. |
| override [WriteTo](RecyclableMemoryStream/WriteTo.md)(…) | Synchronously writes this stream's bytes to the argument stream. |
| [WriteTo](RecyclableMemoryStream/WriteTo.md)(…) | Synchronously writes this stream's bytes, starting at offset, for count bytes, to the argument stream. (5 methods) |
| [WriteTo](RecyclableMemoryStream/WriteTo.md)(…) | Synchronously writes this stream's bytes, starting at offset, for count bytes, to the argument stream. (4 methods) |

## Protected Members

Expand Down
67 changes: 10 additions & 57 deletions docs/Microsoft.IO/RecyclableMemoryStream/RecyclableMemoryStream.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RecyclableMemoryStream constructor (1 of 8)
# RecyclableMemoryStream constructor (1 of 6)

Initializes a new instance of the [`RecyclableMemoryStream`](../RecyclableMemoryStream.md) class.

Expand All @@ -18,7 +18,7 @@ public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager)

---

# RecyclableMemoryStream constructor (2 of 8)
# RecyclableMemoryStream constructor (2 of 6)

Initializes a new instance of the [`RecyclableMemoryStream`](../RecyclableMemoryStream.md) class.

Expand All @@ -39,12 +39,12 @@ public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, Guid

---

# RecyclableMemoryStream constructor (3 of 8)
# RecyclableMemoryStream constructor (3 of 6)

Initializes a new instance of the [`RecyclableMemoryStream`](../RecyclableMemoryStream.md) class.

```csharp
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, string tag)
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, string? tag)
```

| parameter | description |
Expand All @@ -60,12 +60,12 @@ public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, strin

---

# RecyclableMemoryStream constructor (4 of 8)
# RecyclableMemoryStream constructor (4 of 6)

Initializes a new instance of the [`RecyclableMemoryStream`](../RecyclableMemoryStream.md) class.

```csharp
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, Guid id, string tag)
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, Guid id, string? tag)
```

| parameter | description |
Expand All @@ -82,35 +82,12 @@ public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, Guid

---

# RecyclableMemoryStream constructor (5 of 8)
# RecyclableMemoryStream constructor (5 of 6)

Initializes a new instance of the [`RecyclableMemoryStream`](../RecyclableMemoryStream.md) class.

```csharp
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, string tag,
int requestedSize)
```

| parameter | description |
| --- | --- |
| memoryManager | The memory manager |
| tag | A string identifying this stream for logging and debugging purposes. |
| requestedSize | The initial requested size to prevent future allocations. |

## See Also

* class [RecyclableMemoryStreamManager](../RecyclableMemoryStreamManager.md)
* class [RecyclableMemoryStream](../RecyclableMemoryStream.md)
* namespace [Microsoft.IO](../../Microsoft.IO.RecyclableMemoryStream.md)

---

# RecyclableMemoryStream constructor (6 of 8)

Initializes a new instance of the [`RecyclableMemoryStream`](../RecyclableMemoryStream.md) class.

```csharp
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, string tag,
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, string? tag,
long requestedSize)
```

Expand All @@ -128,36 +105,12 @@ public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, strin

---

# RecyclableMemoryStream constructor (7 of 8)

Initializes a new instance of the [`RecyclableMemoryStream`](../RecyclableMemoryStream.md) class.

```csharp
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, Guid id, string tag,
int requestedSize)
```

| parameter | description |
| --- | --- |
| memoryManager | The memory manager. |
| id | A unique identifier which can be used to trace usages of the stream. |
| tag | A string identifying this stream for logging and debugging purposes. |
| requestedSize | The initial requested size to prevent future allocations. |

## See Also

* class [RecyclableMemoryStreamManager](../RecyclableMemoryStreamManager.md)
* class [RecyclableMemoryStream](../RecyclableMemoryStream.md)
* namespace [Microsoft.IO](../../Microsoft.IO.RecyclableMemoryStream.md)

---

# RecyclableMemoryStream constructor (8 of 8)
# RecyclableMemoryStream constructor (6 of 6)

Initializes a new instance of the [`RecyclableMemoryStream`](../RecyclableMemoryStream.md) class.

```csharp
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, Guid id, string tag,
public RecyclableMemoryStream(RecyclableMemoryStreamManager memoryManager, Guid id, string? tag,
long requestedSize)
```

Expand Down
71 changes: 2 additions & 69 deletions docs/Microsoft.IO/RecyclableMemoryStream/SafeRead.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,4 @@
# RecyclableMemoryStream.SafeRead method (1 of 4)

Reads from the specified position into the provided buffer.

```csharp
public int SafeRead(Span<byte> buffer, ref int streamPosition)
```

| parameter | description |
| --- | --- |
| buffer | Destination buffer. |
| streamPosition | Position in the stream to start reading from. |

## Return Value

The number of bytes read.

## Exceptions

| exception | condition |
| --- | --- |
| ObjectDisposedException | Object has been disposed. |
| InvalidOperationException | Stream position is beyond `int.MaxValue`. |

## See Also

* class [RecyclableMemoryStream](../RecyclableMemoryStream.md)
* namespace [Microsoft.IO](../../Microsoft.IO.RecyclableMemoryStream.md)

---

# RecyclableMemoryStream.SafeRead method (2 of 4)
# RecyclableMemoryStream.SafeRead method (1 of 2)

Reads from the specified position into the provided buffer.

Expand Down Expand Up @@ -59,43 +28,7 @@ The number of bytes read.

---

# RecyclableMemoryStream.SafeRead method (3 of 4)

Reads from the specified position into the provided buffer.

```csharp
public int SafeRead(byte[] buffer, int offset, int count, ref int streamPosition)
```

| parameter | description |
| --- | --- |
| buffer | Destination buffer. |
| offset | Offset into buffer at which to start placing the read bytes. |
| count | Number of bytes to read. |
| streamPosition | Position in the stream to start reading from. |

## Return Value

The number of bytes read.

## Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *buffer* is null. |
| ArgumentOutOfRangeException | *offset* or *count* is less than 0. |
| ArgumentException | *offset* subtracted from the buffer length is less than *count*. |
| ObjectDisposedException | Object has been disposed. |
| InvalidOperationException | Stream position is beyond `int.MaxValue`. |

## See Also

* class [RecyclableMemoryStream](../RecyclableMemoryStream.md)
* namespace [Microsoft.IO](../../Microsoft.IO.RecyclableMemoryStream.md)

---

# RecyclableMemoryStream.SafeRead method (4 of 4)
# RecyclableMemoryStream.SafeRead method (2 of 2)

Reads from the specified position into the provided buffer.

Expand Down
32 changes: 1 addition & 31 deletions docs/Microsoft.IO/RecyclableMemoryStream/SafeReadByte.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,4 @@
# RecyclableMemoryStream.SafeReadByte method (1 of 2)

Reads a single byte from the specified position in the stream.

```csharp
public int SafeReadByte(ref int streamPosition)
```

| parameter | description |
| --- | --- |
| streamPosition | The position in the stream to read from. |

## Return Value

The byte at the current position, or -1 if the position is at the end of the stream.

## Exceptions

| exception | condition |
| --- | --- |
| ObjectDisposedException | Object has been disposed. |
| InvalidOperationException | Stream position is beyond `int.MaxValue`. |

## See Also

* class [RecyclableMemoryStream](../RecyclableMemoryStream.md)
* namespace [Microsoft.IO](../../Microsoft.IO.RecyclableMemoryStream.md)

---

# RecyclableMemoryStream.SafeReadByte method (2 of 2)
# RecyclableMemoryStream.SafeReadByte method

Reads a single byte from the specified position in the stream.

Expand Down
2 changes: 1 addition & 1 deletion docs/Microsoft.IO/RecyclableMemoryStream/Seek.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The new position.
| exception | condition |
| --- | --- |
| ObjectDisposedException | Object has been disposed. |
| ArgumentOutOfRangeException | *offset* is larger than [`MaximumStreamCapacity`](../RecyclableMemoryStreamManager/MaximumStreamCapacity.md). |
| ArgumentOutOfRangeException | *offset* is larger than [`MaximumStreamCapacity`](../RecyclableMemoryStreamManager.Options/MaximumStreamCapacity.md). |
| ArgumentException | Invalid seek origin. |
| IOException | Attempt to set negative position. |

Expand Down
2 changes: 1 addition & 1 deletion docs/Microsoft.IO/RecyclableMemoryStream/SetLength.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public override void SetLength(long value)

| exception | condition |
| --- | --- |
| ArgumentOutOfRangeException | value is negative or larger than [`MaximumStreamCapacity`](../RecyclableMemoryStreamManager/MaximumStreamCapacity.md). |
| ArgumentOutOfRangeException | value is negative or larger than [`MaximumStreamCapacity`](../RecyclableMemoryStreamManager.Options/MaximumStreamCapacity.md). |
| ObjectDisposedException | Object has been disposed. |

## See Also
Expand Down
39 changes: 5 additions & 34 deletions docs/Microsoft.IO/RecyclableMemoryStream/WriteTo.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RecyclableMemoryStream.WriteTo method (1 of 6)
# RecyclableMemoryStream.WriteTo method (1 of 5)

Writes bytes from the current stream to a destination `byte` array.

Expand Down Expand Up @@ -28,7 +28,7 @@ The entire stream is written to the target array.

---

# RecyclableMemoryStream.WriteTo method (2 of 6)
# RecyclableMemoryStream.WriteTo method (2 of 5)

Synchronously writes this stream's bytes to the argument stream.

Expand Down Expand Up @@ -58,7 +58,7 @@ Important: This does a synchronous write, which may not be desired in some situa

---

# RecyclableMemoryStream.WriteTo method (3 of 6)
# RecyclableMemoryStream.WriteTo method (3 of 5)

Writes bytes from the current stream to a destination `byte` array.

Expand Down Expand Up @@ -87,36 +87,7 @@ public void WriteTo(byte[] buffer, long offset, long count)

---

# RecyclableMemoryStream.WriteTo method (4 of 6)

Synchronously writes this stream's bytes, starting at offset, for count bytes, to the argument stream.

```csharp
public void WriteTo(Stream stream, int offset, int count)
```

| parameter | description |
| --- | --- |
| stream | Destination stream. |
| offset | Offset in source. |
| count | Number of bytes to write. |

## Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *stream* is null. |
| ArgumentOutOfRangeException | *offset* is less than 0, or *offset* + *count* is beyond this *stream*'s length. |
| ObjectDisposedException | Object has been disposed. |

## See Also

* class [RecyclableMemoryStream](../RecyclableMemoryStream.md)
* namespace [Microsoft.IO](../../Microsoft.IO.RecyclableMemoryStream.md)

---

# RecyclableMemoryStream.WriteTo method (5 of 6)
# RecyclableMemoryStream.WriteTo method (4 of 5)

Synchronously writes this stream's bytes, starting at offset, for count bytes, to the argument stream.

Expand Down Expand Up @@ -145,7 +116,7 @@ public void WriteTo(Stream stream, long offset, long count)

---

# RecyclableMemoryStream.WriteTo method (6 of 6)
# RecyclableMemoryStream.WriteTo method (5 of 5)

Writes bytes from the current stream to a destination `byte` array.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Optional Tag for the event.

```csharp
public string Tag { get; }
public string? Tag { get; }
```

## See Also
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Logged when a stream object is created.

```csharp
public void MemoryStreamCreated(Guid guid, string tag, long requestedSize, long actualSize)
public void MemoryStreamCreated(Guid guid, string? tag, long requestedSize, long actualSize)
```

| parameter | description |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Logged when a buffer is discarded (not put back in the pool, but given to GC to clean up).

```csharp
public void MemoryStreamDiscardBuffer(Guid guid, string tag, MemoryStreamBufferType bufferType,
public void MemoryStreamDiscardBuffer(Guid guid, string? tag, MemoryStreamBufferType bufferType,
MemoryStreamDiscardReason reason, long smallBlocksFree, long smallPoolBytesFree,
long smallPoolBytesInUse, long largeBlocksFree, long largePoolBytesFree,
long largePoolBytesInUse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Logged when the stream is disposed.

```csharp
public void MemoryStreamDisposed(Guid guid, string tag, long lifetimeMs, string allocationStack,
string disposeStack)
public void MemoryStreamDisposed(Guid guid, string? tag, long lifetimeMs, string? allocationStack,
string? disposeStack)
```

| parameter | description |
Expand Down
Loading

0 comments on commit 407ddc3

Please sign in to comment.