Click or drag to resize
BinaryInput Class

Binary standard input. This class provides methods for reading in bits from standard input, either one bit at a time (as a boolean), 8 bits at a time (as a byte or char), 16 bits at a time (as a short), 32 bits at a time (as an int or float), or 64 bits at a time (as a double or long).

All primitive types are assumed to be represented using their standard .NET representations, in little-endian (least significant byte first) order.

The client should not intermix calls to BinaryStdIn with calls to StdIn or Console.In; otherwise unexpected behavior will result.

Inheritance Hierarchy
SystemObject
  Algs4NetBinaryInput

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public sealed class BinaryInput : IDisposable

The BinaryInput type exposes the following members.

Constructors
  NameDescription
Public methodBinaryInput
Represents an input stream from a source, which may not be the standard input
Top
Properties
  NameDescription
Public propertyIsEmpty
Returns true if standard input is empty.
Top
Methods
  NameDescription
Public methodClose
Close this input stream and release any associated system resources.
Public methodDispose
Cleans up the input stream
Public methodStatic memberMainTest
Test client. Reads in a binary input file from standard input and writes it to standard output.
Public methodReadBoolean
Reads the next bit of data from standard input and return as a boolean.
Public methodReadByte
Reads the next 8 bits from standard input and return as an 8-bit byte.
Public methodReadChar
Reads the next 8 bits from standard input and return as an 8-bit char. Note that char is a 16-bit type; to read the next 16 bits as a char, use readChar(16).
Public methodReadChar(Int32)
Reads the next r bits from standard input and return as an r-bit character.
Public methodReadDouble
Reads the next 64 bits from standard input and return as a 64-bit double.
Public methodStatic memberReadFloat
Reads the next 32 bits from standard input and return as a 32-bit float.
Public methodReadInt
Reads the next 32 bits from standard input and return as a 32-bit int.
Public methodReadInt(Int32)
Reads the next r bits from standard input and return as an r-bit int.
Public methodReadLong
Reads the next 64 bits from standard input and return as a 64-bit long.
Public methodReadShort
Reads the next 16 bits from standard input and return as a 16-bit short.
Public methodReadString
Reads the remaining bytes of data from standard input and return as a string. The method is similar to the ReadToEnd method of the .NET Framework.
Top
Remarks
This class is a C# port from the original Java class BinaryStdIn implementation by Robert Sedgewick and Kevin Wayne.
See Also