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

DataWriter Class

将数据写入到输出流。

语法


Public NotInheritable Class DataWriter
    Implements IDataWriter, _
    IDisposable

特性

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

成员

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

构造函数

DataWriter类 具有这些构造函数。

构造函数说明
DataWriter() Creates and initializes a new instance of the data writer.
DataWriter(IOutputStream) Creates and initializes a new instance of the data writer to an output stream.

 

方法

The DataWriter 类 具有这些方法。 对于 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 writer.
DetachStream Detaches the stream that is associated with the data writer.
Dispose [C#, VB]Performs tasks associated with freeing, releasing, or resetting unmanaged resources.
FlushAsync Flushes data asynchronously.
MeasureString Gets the size of a string.
StoreAsync Commits data in the buffer to a backing store.
WriteBoolean Writes a Boolean value to the output stream.
WriteBuffer(IBuffer) Writes the contents of the specified buffer to the output stream.
WriteBuffer(IBuffer, UInt32, UInt32) Writes the specified bytes from a buffer to the output stream.
WriteByte Writes a byte value to the output stream.
WriteBytes Writes an array of byte values to the output stream.
WriteDateTime Writes a date and time value to the output stream.
WriteDouble Writes a floating-point value to the output stream.
WriteGuid Writes a GUID value to the output stream.
WriteInt16 Writes a 16-bit integer value to the output stream.
WriteInt32 Writes a 32-bit integer value to the output stream.
WriteInt64 Writes a 64-bit integer value to the output stream.
WriteSingle Writes a floating-point value to the output stream.
WriteString Writes a string value to the output stream.
WriteTimeSpan Writes a time-interval value to the output stream.
WriteUInt16 Writes a 16-bit unsigned integer value to the output stream.
WriteUInt32 Writes a 32-bit unsigned integer value to the output stream.
WriteUInt64 Writes a 64-bit unsigned integer value to the output stream.

 

属性

DataWriter类 具有这些属性。

属性访问类型说明

ByteOrder

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

UnicodeEncoding

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

UnstoredBufferLength

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

 

示例

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

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

要求

最低支持客户端

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

最低支持服务器

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

最低支持电话

Windows Phone 8

命名空间

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

元数据

Windows.winmd

另请参见

读取和写入数据示例
StreamSocket 示例
DataReader
DataWriterStoreOperation

 

 

显示: