DataWriter 클래스

정의

출력 스트림에 데이터를 씁니다.

public ref class DataWriter sealed : IClosable, IDataWriter
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Storage.Streams.IDataWriterFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class DataWriter final : IClosable, IDataWriter
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Activatable(Windows.Storage.Streams.IDataWriterFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class DataWriter final : IClosable, IDataWriter
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Storage.Streams.IDataWriterFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class DataWriter : System.IDisposable, IDataWriter
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Storage.Streams.IDataWriterFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class DataWriter : System.IDisposable, IDataWriter
function DataWriter(outputStream)
Public NotInheritable Class DataWriter
Implements IDataWriter, IDisposable
상속
Object Platform::Object IInspectable DataWriter
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

DataReader 항목의 코드 예제를 참조하세요.

설명

DataWriter 개체의 인스턴스는 동시 쓰기를 지원하지 않습니다. 애플리케이션이 DataWriter instance 스트림을 동시에 쓰거나 분리하는 경우 개체 호출에 기록되는 스트림은 오류 HRESULT_FROM_WIN32(ERROR_INVALID_OPERATION)으로 인해 실패합니다.

생성자

DataWriter()

데이터 기록기의 새 instance 만들고 초기화합니다.

DataWriter(IOutputStream)

데이터 기록기의 새 instance 만들고 출력 스트림으로 초기화합니다.

속성

ByteOrder

출력 스트림에서 데이터의 바이트 순서를 가져오거나 설정합니다.

UnicodeEncoding

출력 스트림에 대한 유니코드 문자 인코딩을 가져오거나 설정합니다.

UnstoredBufferLength

사용되지 않은 버퍼의 크기를 가져옵니다.

메서드

Close()

현재 스트림을 닫고 시스템 리소스를 해제합니다.

DetachBuffer()

데이터 기록기와 연결된 버퍼를 분리합니다.

DetachStream()

데이터 기록기와 연결된 스트림을 분리합니다.

Dispose()

관리되지 않는 리소스의 확보, 해제 또는 다시 설정과 관련된 애플리케이션 정의 작업을 수행합니다.

FlushAsync()

데이터를 비동기적으로 플러시합니다.

MeasureString(String)

문자열의 크기를 가져옵니다.

StoreAsync()

버퍼의 데이터를 출력 스트림에 커밋합니다. 이 메서드는 DataWriter가 스트림에 쓰는 경우에만 호출해야 합니다. 기본 저장소가 버퍼인 경우 실패합니다.

WriteBoolean(Boolean)

출력 스트림에 부울 값을 씁니다.

WriteBuffer(IBuffer)

지정된 버퍼의 내용을 출력 스트림에 씁니다.

WriteBuffer(IBuffer, UInt32, UInt32)

버퍼에서 지정된 바이트를 출력 스트림에 씁니다.

WriteByte(Byte)

출력 스트림에 바이트 값을 씁니다.

WriteBytes(Byte[])

출력 스트림에 바이트 값 배열을 씁니다.

WriteDateTime(DateTime)

출력 스트림에 날짜 및 시간 값을 씁니다.

WriteDouble(Double)

출력 스트림에 부동 소수점 값을 씁니다.

WriteGuid(Guid)

출력 스트림에 GUID 값을 씁니다.

WriteInt16(Int16)

출력 스트림에 16비트 정수 값을 씁니다.

WriteInt32(Int32)

출력 스트림에 32비트 정수 값을 씁니다.

WriteInt64(Int64)

출력 스트림에 64비트 정수 값을 씁니다.

WriteSingle(Single)

출력 스트림에 부동 소수점 값을 씁니다.

WriteString(String)

출력 스트림에 문자열 값을 씁니다.

WriteTimeSpan(TimeSpan)

시간 간격 값을 출력 스트림에 씁니다.

WriteUInt16(UInt16)

16비트 부호 없는 정수 값을 출력 스트림에 씁니다.

WriteUInt32(UInt32)

32비트 부호 없는 정수 값을 출력 스트림에 씁니다.

WriteUInt64(UInt64)

64비트 부호 없는 정수 값을 출력 스트림에 씁니다.

적용 대상

추가 정보