DataReader class

Applies to Windows and Windows Phone

Reads data from an input stream.

Syntax

Public NotInheritable Class DataReader
    Implements IDataReader, _
    IDisposable

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]

Members

The DataReader class has these types of members:

Constructors

The DataReader class has these constructors.

ConstructorDescription
DataReader Creates and initializes a new instance of the data reader.

 

Methods

The DataReader class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Close [C++, JavaScript]Closes the current stream and releases system resources.
DetachBuffer Detaches the buffer that is associated with the data reader.
DetachStream Detaches the stream that is associated with the data reader.
Dispose [C#, VB]Performs tasks associated with freeing, releasing, or resetting unmanaged resources.
FromBuffer Creates a new instance of the data reader with data from the specified buffer.
LoadAsync Loads data from the input stream.
ReadBoolean Reads a Boolean value from the input stream.
ReadBuffer Reads a buffer from the input stream.
ReadByte Reads a byte value from the input stream.
ReadBytes Reads an array of byte values from the input stream.
ReadDateTime Reads a date and time value from the input stream.
ReadDouble Reads a floating-point value from the input stream.
ReadGuid Reads a GUID value from the input stream.
ReadInt16 Reads a 16-bit integer value from the input stream.
ReadInt32 Reads a 32-bit integer value from the input stream.
ReadInt64 Reads a 64-bit integer value from the input stream.
ReadSingle Reads a floating-point value from the input stream.
ReadString Reads a string value from the input stream.
ReadTimeSpan Reads a time-interval value from the input stream.
ReadUInt16 Reads a 16-bit unsigned integer from the input stream.
ReadUInt32 Reads a 32-bit unsigned integer from the input stream.
ReadUInt64 Reads a 64-bit unsigned integer from the input stream.

 

Properties

The DataReader class has these properties.

PropertyAccess typeDescription

ByteOrder

Read/writeGets or sets the byte order of the data in the input stream.

InputStreamOptions

Read/writeGets or sets the read options for the input stream.

UnconsumedBufferLength

Read-onlyGets the size of the buffer that has not been read.

UnicodeEncoding

Read/writeGets or sets the Unicode character encoding for the input stream.

 

Examples

The following example shows how to write and read strings to an in-memory stream. For the full code sample, see Reading and writing data sample.

No code example is currently available or this language may not be supported.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

Windows.Storage.Streams
Windows::Storage::Streams [C++]

Metadata

Windows.winmd

See also

Reading and writing data sample
StreamSocket sample
DataReaderLoadOperation
DataWriter

 

 

Show:
© 2014 Microsoft