Constructors: NewBinaryReader |
Returns a new BinaryReader that can read from the specified stream usind the specified encoding.
Public Function NewBinaryReader( ByVal InputStream As Stream, Optional ByVal Encoding As Encoding, Optional ByVal LeaveOpen As Boolean ) As BinaryReader
If Encoding is not specified, then the reader is created using UTF8Encoding.
Exception | Condition |
---|---|
ArgumentNullException | InputStream is Nothing. |
ArgumentException | The stream does not support reading, or is already closed. |
The following example demonstrates the two ways to create a BinaryReader object using the NewBinaryReader constructor method.
Public Sub Main() Dim Source As FileStream Dim Reader As BinaryReader Set Source = File.OpenFile("MyFile.txt", FileMode.OpenExisting) ' method one Set Reader = NewBinaryReader(Source) ' method two Set Reader = Cor.NewBinaryReader(Source) End Sub