-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNativeTextReader.cs
49 lines (42 loc) · 2.24 KB
/
NativeTextReader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System.IO;
using System.Text;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
namespace Gilzoide.NativeCollectionsStream
{
public class NativeTextReader : StreamReader
{
public NativeTextReader(NativeText text) : this(text, 1024) {}
public NativeTextReader(NativeText text, int bufferSize) : base(new NativeTextStream(text), Encoding.UTF8, false, bufferSize) {}
}
public class UnsafeTextReader : StreamReader
{
public UnsafeTextReader(UnsafeText text) : this(text, 1024) {}
public UnsafeTextReader(UnsafeText text, int bufferSize) : base(new UnsafeTextStream(text), Encoding.UTF8, false, bufferSize) {}
}
public class FixedString32BytesReader : StreamReader
{
public FixedString32BytesReader(FixedString32Bytes text) : this(text, 32) {}
public FixedString32BytesReader(FixedString32Bytes text, int bufferSize) : base(new FixedString32BytesStream(text), Encoding.UTF8, false, bufferSize) {}
}
public class FixedString64BytesReader : StreamReader
{
public FixedString64BytesReader(FixedString64Bytes text) : this(text, 64) {}
public FixedString64BytesReader(FixedString64Bytes text, int bufferSize) : base(new FixedString64BytesStream(text), Encoding.UTF8, false, bufferSize) {}
}
public class FixedString128BytesReader : StreamReader
{
public FixedString128BytesReader(FixedString128Bytes text) : this(text, 128) {}
public FixedString128BytesReader(FixedString128Bytes text, int bufferSize) : base(new FixedString128BytesStream(text), Encoding.UTF8, false, bufferSize) {}
}
public class FixedString512BytesReader : StreamReader
{
public FixedString512BytesReader(FixedString512Bytes text) : this(text, 512) {}
public FixedString512BytesReader(FixedString512Bytes text, int bufferSize) : base(new FixedString512BytesStream(text), Encoding.UTF8, false, bufferSize) {}
}
public class FixedString4096BytesReader : StreamReader
{
public FixedString4096BytesReader(FixedString4096Bytes text) : this(text, 1024) {}
public FixedString4096BytesReader(FixedString4096Bytes text, int bufferSize) : base(new FixedString4096BytesStream(text), Encoding.UTF8, false, bufferSize) {}
}
}