DataWriter DataWriter DataWriter DataWriter DataWriter Class

Definition

Writes data to an output stream.

public : sealed class DataWriter : IClosable, IDataWriter
struct winrt::Windows::Storage::Streams::DataWriter : IClosable, IDataWriter
public sealed class DataWriter : IDisposable, IDataWriter
Public NotInheritable Class DataWriter Implements IDisposable, IDataWriter
var dataWriter = new dataWriter();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

See the code example in the DataReader topic.

Remarks

Instances of DataWriter objects do not support concurrent writes. If an application concurrently writes or detaches a stream from a DataWriter instance that is being written to the call to the object will fail with the error HRESULT_FROM_WIN32(ERROR_INVALID_OPERATION).

Constructors

DataWriter() DataWriter() DataWriter() DataWriter() DataWriter()

Creates and initializes a new instance of the data writer.

DataWriter(IOutputStream) DataWriter(IOutputStream) DataWriter(IOutputStream) DataWriter(IOutputStream) DataWriter(IOutputStream)

Creates and initializes a new instance of the data writer to an output stream.

Properties

ByteOrder ByteOrder ByteOrder ByteOrder ByteOrder

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

UnicodeEncoding UnicodeEncoding UnicodeEncoding UnicodeEncoding UnicodeEncoding

Gets or sets the Unicode character encoding for the output stream.

UnstoredBufferLength UnstoredBufferLength UnstoredBufferLength UnstoredBufferLength UnstoredBufferLength

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

Methods

Close() Close() Close() Close() Close()

Closes the current stream and releases system resources.

DetachBuffer() DetachBuffer() DetachBuffer() DetachBuffer() DetachBuffer()

Detaches the buffer that is associated with the data writer.

DetachStream() DetachStream() DetachStream() DetachStream() DetachStream()

Detaches the stream that is associated with the data writer.

Dispose() Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

FlushAsync() FlushAsync() FlushAsync() FlushAsync() FlushAsync()

Flushes data asynchronously.

MeasureString(String) MeasureString(String) MeasureString(String) MeasureString(String) MeasureString(String)

Gets the size of a string.

StoreAsync() StoreAsync() StoreAsync() StoreAsync() StoreAsync()

Commits data in the buffer to the output stream. This method should only be called when the DataWriter is writing into a stream; it will fail when the underlying store is a buffer.

WriteBoolean(Boolean) WriteBoolean(Boolean) WriteBoolean(Boolean) WriteBoolean(Boolean) WriteBoolean(Boolean)

Writes a Boolean value to the output stream.

WriteBuffer(IBuffer) WriteBuffer(IBuffer) WriteBuffer(IBuffer) WriteBuffer(IBuffer) WriteBuffer(IBuffer)

Writes the contents of the specified buffer to the output stream.

WriteBuffer(IBuffer, UInt32, UInt32) WriteBuffer(IBuffer, UInt32, UInt32) WriteBuffer(IBuffer, UInt32, UInt32) WriteBuffer(IBuffer, UInt32, UInt32) WriteBuffer(IBuffer, UInt32, UInt32)

Writes the specified bytes from a buffer to the output stream.

WriteByte(Byte) WriteByte(Byte) WriteByte(Byte) WriteByte(Byte) WriteByte(Byte)

Writes a byte value to the output stream.

WriteBytes(Byte[]) WriteBytes(Byte[]) WriteBytes(Byte[]) WriteBytes(Byte[]) WriteBytes(Byte[])

Writes an array of byte values to the output stream.

WriteDateTime(DateTime) WriteDateTime(DateTime) WriteDateTime(DateTime) WriteDateTime(DateTime) WriteDateTime(DateTime)

Writes a date and time value to the output stream.

WriteDouble(Double) WriteDouble(Double) WriteDouble(Double) WriteDouble(Double) WriteDouble(Double)

Writes a floating-point value to the output stream.

WriteGuid(Guid) WriteGuid(Guid) WriteGuid(Guid) WriteGuid(Guid) WriteGuid(Guid)

Writes a GUID value to the output stream.

WriteInt16(Int16) WriteInt16(Int16) WriteInt16(Int16) WriteInt16(Int16) WriteInt16(Int16)

Writes a 16-bit integer value to the output stream.

WriteInt32(Int32) WriteInt32(Int32) WriteInt32(Int32) WriteInt32(Int32) WriteInt32(Int32)

Writes a 32-bit integer value to the output stream.

WriteInt64(Int64) WriteInt64(Int64) WriteInt64(Int64) WriteInt64(Int64) WriteInt64(Int64)

Writes a 64-bit integer value to the output stream.

WriteSingle(Single) WriteSingle(Single) WriteSingle(Single) WriteSingle(Single) WriteSingle(Single)

Writes a floating-point value to the output stream.

WriteString(String) WriteString(String) WriteString(String) WriteString(String) WriteString(String)

Writes a string value to the output stream.

WriteTimeSpan(TimeSpan) WriteTimeSpan(TimeSpan) WriteTimeSpan(TimeSpan) WriteTimeSpan(TimeSpan) WriteTimeSpan(TimeSpan)

Writes a time-interval value to the output stream.

WriteUInt16(UInt16) WriteUInt16(UInt16) WriteUInt16(UInt16) WriteUInt16(UInt16) WriteUInt16(UInt16)

Writes a 16-bit unsigned integer value to the output stream.

WriteUInt32(UInt32) WriteUInt32(UInt32) WriteUInt32(UInt32) WriteUInt32(UInt32) WriteUInt32(UInt32)

Writes a 32-bit unsigned integer value to the output stream.

WriteUInt64(UInt64) WriteUInt64(UInt64) WriteUInt64(UInt64) WriteUInt64(UInt64) WriteUInt64(UInt64)

Writes a 64-bit unsigned integer value to the output stream.

See Also