StreamWriter.AutoFlush 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
StreamWriter가 Write(Char)를 호출할 때마다 해당 버퍼를 내부 스트림에 플러시할지 여부를 나타내는 값을 가져오거나 설정합니다.
public:
virtual property bool AutoFlush { bool get(); void set(bool value); };
public virtual bool AutoFlush { get; set; }
member this.AutoFlush : bool with get, set
Public Overridable Property AutoFlush As Boolean
속성 값
StreamWriter가 해당 버퍼를 플러시하게 하려면 true
이고, 그렇지 않으면 false
입니다.
예제
다음 예제에서는 사용 하는 구문을 보여 있습니다는 AutoFlush
속성입니다.
// Gets or sets a value indicating whether the StreamWriter
// will flush its buffer to the underlying stream after every
// call to StreamWriter.Write.
sw->AutoFlush = true;
// Gets or sets a value indicating whether the StreamWriter
// will flush its buffer to the underlying stream after every
// call to StreamWriter.Write.
sw.AutoFlush = true;
' Gets or sets a value indicating whether the StreamWriter
' will flush its buffer to the underlying stream after every
' call to StreamWriter.Write.
Sw.AutoFlush = True
설명
또는 를 명시적으로 호출하지 않는 한 스트림을 플러시해도 내부 인코더가 플러시되지 Flush Close 않습니다. AutoFlush를 로 true
설정하면 각 쓰기 작업 후에 데이터가 버퍼에서 스트림으로 플러시되지만 인코더 상태는 플러시되지 않습니다. 이렇게 하면 인코더가 다음 문자 블록을 올바르게 인코딩할 수 있도록 해당 상태(부분 문자)를 유지할 수 있습니다. 이 시나리오는 인코더가 인접 문자 또는 문자를 받은 후에만 특정 문자를 인코딩할 수 있는 UTF8 및 UTF7에 영향을 미칩니다.
가 로 설정된 경우 는 AutoFlush
false
StreamWriter
전달한 인코딩의 인코더에서 내부 및 잠재적으로 제한된 양의 버퍼링을 수행합니다. 를 사용하여 AutoFlush
false
작성을 마쳤을 때 항상 Close
(또는 적어도 )를 호출한다고 가정하면 를 로 설정하여 성능을 향상할 수 Flush
StreamWriter
있습니다.
예를 들어, 설정 AutoFlush
에 true
사용자 대 한 즉각적인 피드백을 기대 하는 디바이스에 작성 하는 경우. Console.Out
는 이러한 경우 중 하나입니다. 에 StreamWriter
대한 모든 호출 후 Console
인코더 상태를 제외한 모든 내부 상태를 플러시하기 위해 쓰기에 내부적으로 사용되는 StreamWriter.Write 입니다.
일반적인 I/O 작업 목록은 일반적인 I/O 작업 을 참조하세요.