Class StreamExtensions
Extension methods that make a System.IO.Stream effectively into a binary serializer with no encoding. We simply convert types into bytes and write them without any concern whether surrogate pairs are respected, similar to what BinaryFormatter does. This makes it possible to serialize/deserialize raw character arrays and get the data back in the same order without any exceptions warning that the order is not valid and without the need for BinaryFormatter.
Byte order is little-endian (same as System.IO.BinaryReader and System.IO.BinaryWriter).
Inheritance
System.Object
StreamExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Lucene.Net.Support.IO
Assembly: Lucene.Net.dll
Syntax
public static class StreamExtensions
Methods
| Improve this Doc View SourceReadChars(Stream, Int32)
Declaration
public static char[] ReadChars(this Stream stream, int count)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Int32 | count |
Returns
Type | Description |
---|---|
System.Char[] |
ReadInt32(Stream)
Declaration
public static int ReadInt32(this Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
Returns
Type | Description |
---|---|
System.Int32 |
ReadInt64(Stream)
Declaration
public static long ReadInt64(this Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
Returns
Type | Description |
---|---|
System.Int64 |
Write(Stream, Char[])
Declaration
public static void Write(this Stream stream, char[] chars)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Char[] | chars |
Write(Stream, Int32)
Declaration
public static void Write(this Stream stream, int value)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Int32 | value |
Write(Stream, Int64)
Declaration
public static void Write(this Stream stream, long value)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Int64 | value |