Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 9afd822

Browse files
committed
Add missing MemoryString(capacity) API
1 parent 6aef891 commit 9afd822

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ServiceStack.Text/RecyclableMemoryStream.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ public static MemoryStream GetStream()
4848
: new MemoryStream();
4949
}
5050

51+
public static MemoryStream GetStream(int capacity)
52+
{
53+
return UseRecyclableMemoryStream
54+
? RecyclableInstance.GetStream(typeof(MemoryStreamFactory).Name, capacity)
55+
: new MemoryStream(capacity);
56+
}
57+
5158
public static MemoryStream GetStream(byte[] bytes)
5259
{
5360
return UseRecyclableMemoryStream
@@ -67,6 +74,11 @@ public static MemoryStream CreateMemoryStream()
6774
return new MemoryStream();
6875
}
6976

77+
public static MemoryStream GetStream(int capacity)
78+
{
79+
return new MemoryStream(capacity);
80+
}
81+
7082
public static MemoryStream CreateMemoryStream(byte[] bytes)
7183
{
7284
return new MemoryStream(bytes);

0 commit comments

Comments
 (0)