Upravit

Sdílet prostřednictvím


Encoding.CreateTranscodingStream(Stream, Encoding, Encoding, Boolean) Method

Definition

Creates a Stream that serves to transcode data between an inner Encoding and an outer Encoding, similar to Convert(Encoding, Encoding, Byte[]).

public static System.IO.Stream CreateTranscodingStream (System.IO.Stream innerStream, System.Text.Encoding innerStreamEncoding, System.Text.Encoding outerStreamEncoding, bool leaveOpen = false);
static member CreateTranscodingStream : System.IO.Stream * System.Text.Encoding * System.Text.Encoding * bool -> System.IO.Stream
Public Shared Function CreateTranscodingStream (innerStream As Stream, innerStreamEncoding As Encoding, outerStreamEncoding As Encoding, Optional leaveOpen As Boolean = false) As Stream

Parameters

innerStream
Stream

The stream to wrap.

innerStreamEncoding
Encoding

The encoding associated with innerStream.

outerStreamEncoding
Encoding

The encoding associated with the Stream that's returned by this method.

leaveOpen
Boolean

true if disposing the Stream returned by this method should not dispose innerStream.

Returns

A stream that transcodes the contents of innerStream as outerStreamEncoding.

Remarks

The returned Stream's CanRead and CanWrite properties will reflect whether innerStream is readable or writable. If innerStream is full-duplex, the returned Stream will be as well. However, the returned Stream is not seekable, even if innerStream's CanSeek property returns true.

Applies to