信息
您所需的主题如下所示。但此主题未包含在此库中。

DataReader Class

从输入流读取数据。

语法


Public NotInheritable Class DataReader
    Implements IDataReader, _
    IDisposable

特性

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

成员

DataReader类 具有这些类型的成员:

构造函数

DataReader类 具有这些构造函数。

构造函数说明
DataReader Creates and initializes a new instance of the data reader.

 

方法

The DataReader 类 具有这些方法。 对于 C#、Visual Basic 和 C++,它还继承方法于Object 类.

方法说明
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.

 

属性

DataReader类 具有这些属性。

属性访问类型说明

ByteOrder

读/写Gets or sets the byte order of the data in the input stream.

InputStreamOptions

读/写Gets or sets the read options for the input stream.

UnconsumedBufferLength

只读Gets the size of the buffer that has not been read.

UnicodeEncoding

读/写Gets or sets the Unicode character encoding for the input stream.

 

示例

下面的示例显示如何向内存流写入并读取字符串。有关完整的代码示例,请参见读取和写入数据示例

目前没有可用的代码示例或不支持该语言。

要求

最低支持客户端

Windows 8 [仅 Windows 应用商店应用程序]

最低支持服务器

Windows Server 2012 [仅 Windows 应用商店应用程序]

最低支持电话

Windows Phone 8

命名空间

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

元数据

Windows.winmd

另请参见

读取和写入数据示例
StreamSocket 示例
DataReaderLoadOperation
DataWriter

 

 

显示: