FileStream Sınıf
Tanım
public ref class FileStream : System::IO::Stream
public class FileStream : System.IO.Stream
[System.Runtime.InteropServices.ComVisible(true)]
public class FileStream : System.IO.Stream
type FileStream = class
inherit Stream
[<System.Runtime.InteropServices.ComVisible(true)>]
type FileStream = class
inherit Stream
Public Class FileStream
Inherits Stream
- Devralma
- Devralma
- Türetilmiş
- Öznitelikler
Örnekler
Aşağıdaki örnek, oluşturucuların bazılarını göstermektedir FileStream .The following example demonstrates some of the FileStream constructors.
using namespace System;
using namespace System::IO;
using namespace System::Text;
void AddText( FileStream^ fs, String^ value )
{
array<Byte>^info = (gcnew UTF8Encoding( true ))->GetBytes( value );
fs->Write( info, 0, info->Length );
}
int main()
{
String^ path = "c:\\temp\\MyTest.txt";
// Delete the file if it exists.
if ( File::Exists( path ) )
{
File::Delete( path );
}
//Create the file.
{
FileStream^ fs = File::Create( path );
try
{
AddText( fs, "This is some text" );
AddText( fs, "This is some more text," );
AddText( fs, "\r\nand this is on a new line" );
AddText( fs, "\r\n\r\nThe following is a subset of characters:\r\n" );
for ( int i = 1; i < 120; i++ )
{
AddText( fs, Convert::ToChar( i ).ToString() );
//Split the output at every 10th character.
if ( Math::IEEERemainder( Convert::ToDouble( i ), 10 ) == 0 )
{
AddText( fs, "\r\n" );
}
}
}
finally
{
if ( fs )
delete (IDisposable^)fs;
}
}
//Open the stream and read it back.
{
FileStream^ fs = File::OpenRead( path );
try
{
array<Byte>^b = gcnew array<Byte>(1024);
UTF8Encoding^ temp = gcnew UTF8Encoding( true );
while ( fs->Read( b, 0, b->Length ) > 0 )
{
Console::WriteLine( temp->GetString( b ) );
}
}
finally
{
if ( fs )
delete (IDisposable^)fs;
}
}
}
using System;
using System.IO;
using System.Text;
class Test
{
public static void Main()
{
string path = @"c:\temp\MyTest.txt";
// Delete the file if it exists.
if (File.Exists(path))
{
File.Delete(path);
}
//Create the file.
using (FileStream fs = File.Create(path))
{
AddText(fs, "This is some text");
AddText(fs, "This is some more text,");
AddText(fs, "\r\nand this is on a new line");
AddText(fs, "\r\n\r\nThe following is a subset of characters:\r\n");
for (int i=1;i < 120;i++)
{
AddText(fs, Convert.ToChar(i).ToString());
}
}
//Open the stream and read it back.
using (FileStream fs = File.OpenRead(path))
{
byte[] b = new byte[1024];
UTF8Encoding temp = new UTF8Encoding(true);
while (fs.Read(b,0,b.Length) > 0)
{
Console.WriteLine(temp.GetString(b));
}
}
}
private static void AddText(FileStream fs, string value)
{
byte[] info = new UTF8Encoding(true).GetBytes(value);
fs.Write(info, 0, info.Length);
}
}
Imports System.IO
Imports System.Text
Public Class Test
Public Shared Sub Main()
Dim path As String = "c:\temp\MyTest.txt"
' Delete the file if it exists.
If File.Exists(path) Then
File.Delete(path)
End If
'Create the file.
Dim fs As FileStream = File.Create(path)
AddText(fs, "This is some text")
AddText(fs, "This is some more text,")
AddText(fs, Environment.NewLine & "and this is on a new line")
AddText(fs, Environment.NewLine & Environment.NewLine)
AddText(fs, "The following is a subset of characters:" & Environment.NewLine)
Dim i As Integer
For i = 1 To 120
AddText(fs, Convert.ToChar(i).ToString())
Next
fs.Close()
'Open the stream and read it back.
fs = File.OpenRead(path)
Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
Console.WriteLine(temp.GetString(b))
Loop
fs.Close()
End Sub
Private Shared Sub AddText(ByVal fs As FileStream, ByVal value As String)
Dim info As Byte() = New UTF8Encoding(True).GetBytes(value)
fs.Write(info, 0, info.Length)
End Sub
End Class
Aşağıdaki örnek, zaman uyumsuz olarak bir dosyaya nasıl yazılacağını gösterir.The following example shows how to write to a file asynchronously. Bu kod, Userınput adlı bir TextBlock uygulaması ve Button_Click adlı bir tıklama olayı işleyicisine bir düğme bağlayan bir WPF uygulamasında çalışır.This code runs in a WPF app that has a TextBlock named UserInput and a button hooked up to a Click event handler that is named Button_Click. Dosya yolunun, bilgisayarda bulunan bir dosya olarak değiştirilmesi gerekir.The file path needs to be changed to a file that exists on the computer.
using System;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.IO;
namespace WpfApplication1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
UnicodeEncoding uniencoding = new UnicodeEncoding();
string filename = @"c:\Users\exampleuser\Documents\userinputlog.txt";
byte[] result = uniencoding.GetBytes(UserInput.Text);
using (FileStream SourceStream = File.Open(filename, FileMode.OpenOrCreate))
{
SourceStream.Seek(0, SeekOrigin.End);
await SourceStream.WriteAsync(result, 0, result.Length);
}
}
}
}
Imports System.IO
Imports System.Text
Class MainWindow
Private Async Sub Button_Click(sender As Object, e As RoutedEventArgs)
Dim uniencoding As UnicodeEncoding = New UnicodeEncoding()
Dim filename As String = "c:\Users\exampleuser\Documents\userinputlog.txt"
Dim result As Byte() = uniencoding.GetBytes(UserInput.Text)
Using SourceStream As FileStream = File.Open(filename, FileMode.OpenOrCreate)
SourceStream.Seek(0, SeekOrigin.End)
Await SourceStream.WriteAsync(result, 0, result.Length)
End Using
End Sub
End Class
Açıklamalar
FileStreamBir dosya sistemindeki dosyaları okumak, yazmak, açmak ve kapatmak ve kanallar, standart giriş ve standart çıkış dahil diğer dosyayla ilgili işletim sistemi tutamaçlarını işlemek için sınıfını kullanın.Use the FileStream class to read from, write to, open, and close files on a file system, and to manipulate other file-related operating system handles, including pipes, standard input, and standard output. Zaman Read Write CopyTo Flush ReadAsync WriteAsync CopyToAsync FlushAsync uyumsuz işlemleri gerçekleştirmek için,, ve yöntemlerini zaman uyumlu işlemler veya,, ve yöntemlerini kullanabilirsiniz.You can use the Read, Write, CopyTo, and Flush methods to perform synchronous operations, or the ReadAsync, WriteAsync, CopyToAsync, and FlushAsync methods to perform asynchronous operations. Ana iş parçacığını engellemeden Kaynak yoğunluklu dosya işlemleri gerçekleştirmek için zaman uyumsuz yöntemleri kullanın.Use the asynchronous methods to perform resource-intensive file operations without blocking the main thread. Bu performans açısından, zaman alan bir akış işleminin Kullanıcı arabirimi iş parçacığını engelleyebileceği ve uygulamanızın çalışmıyor gibi görünmesine neden olduğu bir Windows 8. x Mağazası uygulamasında veya masaüstü uygulamasında özellikle önemlidir.This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. FileStream daha iyi performans için girişi ve Çıktıyı arabelleğe alır.FileStream buffers input and output for better performance.
Önemli
Bu tür, IDisposable arabirimini uygular.This type implements the IDisposable interface. Türü kullanmayı bitirdiğinizde, bunu doğrudan veya dolaylı olarak atabilirsiniz.When you have finished using the type, you should dispose of it either directly or indirectly. Türü doğrudan atmak için, Dispose yöntemini bir try / catch blokta çağırın.To dispose of the type directly, call its Dispose method in a try/catch block. Dolaylı olarak atmak için using (C# dilinde) veya (Visual Basic) gibi bir dil yapısı kullanın Using .To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). Daha fazla bilgi için, interface konusunun "IDisposable uygulayan bir nesne kullanma" bölümüne bakın IDisposable .For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.
IsAsyncÖzelliği, dosya tanıtıcısının zaman uyumsuz olarak açılıp açılmadığını algılar.The IsAsync property detects whether the file handle was opened asynchronously. Bu değeri FileStream isAsync ,, useAsync veya parametresi olan bir oluşturucuyu kullanarak sınıfının bir örneğini oluşturduğunuzda belirtirsiniz options .You specify this value when you create an instance of the FileStream class using a constructor that has an isAsync, useAsync, or options parameter. Özelliği olduğunda true , akış zaman uyumsuz olarak dosya işlemleri gerçekleştirmek için çakışan g/ç kullanır.When the property is true, the stream utilizes overlapped I/O to perform file operations asynchronously. Ancak, IsAsync özelliğinin true ,, ReadAsync WriteAsync veya yöntemini çağırmak için CopyToAsync olması gerekmez.However, the IsAsync property does not have to be true to call the ReadAsync, WriteAsync, or CopyToAsync method. Özelliği olduğunda IsAsync false ve zaman uyumsuz okuma ve yazma işlemlerini ÇAĞıRDıĞıNıZDA, UI iş parçacığı hala engellenmez, ancak gerçek g/ç işlemi eşzamanlı olarak gerçekleştirilir.When the IsAsync property is false and you call the asynchronous read and write operations, the UI thread is still not blocked, but the actual I/O operation is performed synchronously.
SeekYöntemi, dosyalara rastgele erişimi destekler.The Seek method supports random access to files. Seek okuma/yazma konumunun dosya içinde herhangi bir konuma taşınmasına izin verir.Seek allows the read/write position to be moved to any position within the file. Bu, bayt kayması başvuru noktası parametreleriyle yapılır.This is done with byte offset reference point parameters. Bayt boşluğu, numaralandırmanın üç üyesi tarafından temsil edildiği şekilde, başlangıç, geçerli konum veya temel alınan dosyanın sonu olabilen Seek başvuru noktasına göredir SeekOrigin .The byte offset is relative to the seek reference point, which can be the beginning, the current position, or the end of the underlying file, as represented by the three members of the SeekOrigin enumeration.
Not
Disk dosyaları her zaman rastgele erişimi destekler.Disk files always support random access. Oluşturma sırasında CanSeek özellik değeri, true false temel alınan dosya türüne göre veya olarak ayarlanır.At the time of construction, the CanSeek property value is set to true or false depending on the underlying file type. Temel alınan dosya türü, Winbase. h içinde tanımlandığı gibi FILE_TYPE_DISK, CanSeek özellik değeri ise olur true .If the underlying file type is FILE_TYPE_DISK, as defined in winbase.h, the CanSeek property value is true. Aksi halde, CanSeek özellik değeri false .Otherwise, the CanSeek property value is false.
Bir işlem kilitli bir dosyanın parçası ile sonlandığında veya bekleyen kilitleri olan bir dosyayı kapatırsa, bu davranış tanımsızdır.If a process terminates with part of a file locked or closes a file that has outstanding locks, the behavior is undefined.
Dizin işlemleri ve diğer dosya işlemleri için bkz., File Directory , ve Path sınıfları.For directory operations and other file operations, see the File, Directory, and Path classes. FileSınıfı, öncelikle FileStream Dosya yollarına göre nesne oluşturulmasına yönelik statik yöntemlere sahip bir yardımcı programdır.The File class is a utility class that has static methods primarily for the creation of FileStream objects based on file paths. MemoryStreamSınıfı, bir bayt dizisinden bir akış oluşturur ve FileStream sınıfa benzerdir.The MemoryStream class creates a stream from a byte array and is similar to the FileStream class.
Ortak dosya ve dizin işlemlerinin bir listesi için bkz. ortak g/ç görevleri.For a list of common file and directory operations, see Common I/O Tasks.
Akış Konumu Değişikliklerinin AlgılanmasıDetection of Stream Position Changes
Bir FileStream nesnenin kendi tutamacı üzerinde özel bir tutma işlemi olmadığında, başka bir iş parçacığı dosya tanıtıcısına eşzamanlı olarak erişebilir ve dosya tutamacı ile ilişkili işletim sisteminin dosya işaretçisinin konumunu değiştirebilir.When a FileStream object does not have an exclusive hold on its handle, another thread could access the file handle concurrently and change the position of the operating system's file pointer that is associated with the file handle. Bu durumda, nesnedeki önbelleğe alınmış konumun FileStream ve arabellekteki önbellekteki verilerin güvenliği tehlikeye girebilir.In this case, the cached position in the FileStream object and the cached data in the buffer could be compromised. FileStreamNesne, işletim sisteminin tanıtıcı konumunun nesne tarafından kullanılan önbelleğe alınmış konum ile aynı olmasını sağlamak için, önbelleğe alınmış arabelleğe erişen yöntemler üzerinde denetimleri gerçekleştirir FileStream .The FileStream object routinely performs checks on methods that access the cached buffer to ensure that the operating system's handle position is the same as the cached position used by the FileStream object.
Yönteme yapılan çağrıda tanıtıcı konumunda beklenmeyen bir değişiklik algılanırsa Read , .NET Framework arabelleğin içeriğini atar ve dosyadan akışı yeniden okur.If an unexpected change in the handle position is detected in a call to the Read method, the .NET Framework discards the contents of the buffer and reads the stream from the file again. Bu, dosyanın boyutuna ve dosya akışının konumunu etkileyebilecek diğer işlemlere bağlı olarak performansı etkileyebilir.This can affect performance, depending on the size of the file and any other processes that could affect the position of the file stream.
Metoda yapılan çağrıda tanıtıcı konumunda beklenmeyen bir değişiklik algılanırsa Write , arabelleğin içeriği atılır ve bir IOException özel durum oluşturulur.If an unexpected change in the handle position is detected in a call to the Write method, the contents of the buffer are discarded and an IOException exception is thrown.
FileStream SafeFileHandle Özelliğin tanıtıcıyı açığa çıkarmak için erişim izni verildiğinde veya FileStream nesne kendi oluşturucusunda özelliği verilirse, nesnenin kendi tutamacı üzerinde özel bir beklemeye sahip olmaz SafeFileHandle .A FileStream object will not have an exclusive hold on its handle when either the SafeFileHandle property is accessed to expose the handle or the FileStream object is given the SafeFileHandle property in its constructor.
Oluşturucular
| FileStream(IntPtr, FileAccess) |
Kullanımdan kalktı.
Kullanımdan kalktı.
Kullanımdan kalktı.
Belirtilen FileStream okuma/yazma izniyle belirtilen dosya tanıtıcısı için sınıfın yeni bir örneğini başlatır.Initializes a new instance of the FileStream class for the specified file handle, with the specified read/write permission. |
| FileStream(IntPtr, FileAccess, Boolean) |
Kullanımdan kalktı.
Kullanımdan kalktı.
Kullanımdan kalktı.
Belirtilen FileStream okuma/yazma izni ve örnek sahipliğiyle, belirtilen dosya tanıtıcısı için sınıfın yeni bir örneğini başlatır |
| FileStream(IntPtr, FileAccess, Boolean, Int32) |
Kullanımdan kalktı.
Kullanımdan kalktı.
Kullanımdan kalktı.
Belirtilen FileStream okuma/yazma izni, |
| FileStream(IntPtr, FileAccess, Boolean, Int32, Boolean) |
Kullanımdan kalktı.
Kullanımdan kalktı.
Kullanımdan kalktı.
Belirtilen FileStream okuma/yazma izni, |
| FileStream(SafeFileHandle, FileAccess) |
Belirtilen FileStream okuma/yazma izniyle belirtilen dosya tanıtıcısı için sınıfın yeni bir örneğini başlatır.Initializes a new instance of the FileStream class for the specified file handle, with the specified read/write permission. |
| FileStream(SafeFileHandle, FileAccess, Int32) |
Belirtilen FileStream okuma/yazma izniyle ve arabellek boyutuyla belirtilen dosya tanıtıcısı için sınıfın yeni bir örneğini başlatır.Initializes a new instance of the FileStream class for the specified file handle, with the specified read/write permission, and buffer size. |
| FileStream(SafeFileHandle, FileAccess, Int32, Boolean) |
Belirtilen FileStream okuma/yazma izni, arabellek boyutu, zaman uyumlu veya zaman uyumsuz durumuyla, belirtilen dosya tanıtıcısı için sınıfın yeni bir örneğini başlatır.Initializes a new instance of the FileStream class for the specified file handle, with the specified read/write permission, buffer size, and synchronous or asynchronous state. |
| FileStream(String, FileMode) |
FileStreamBelirtilen yol ve oluşturma moduyla sınıfının yeni bir örneğini başlatır.Initializes a new instance of the FileStream class with the specified path and creation mode. |
| FileStream(String, FileMode, FileAccess) |
FileStreamBelirtilen yol, oluşturma modu ve okuma/yazma izniyle sınıfının yeni bir örneğini başlatır.Initializes a new instance of the FileStream class with the specified path, creation mode, and read/write permission. |
| FileStream(String, FileMode, FileAccess, FileShare) |
FileStreamBelirtilen yol, oluşturma modu, okuma/yazma izni ve paylaşım izniyle sınıfının yeni bir örneğini başlatır.Initializes a new instance of the FileStream class with the specified path, creation mode, read/write permission, and sharing permission. |
| FileStream(String, FileMode, FileAccess, FileShare, Int32) |
FileStreamBelirtilen yol, oluşturma modu, okuma/yazma ve paylaşma izni ve arabellek boyutu ile sınıfın yeni bir örneğini başlatır.Initializes a new instance of the FileStream class with the specified path, creation mode, read/write and sharing permission, and buffer size. |
| FileStream(String, FileMode, FileAccess, FileShare, Int32, Boolean) |
FileStreamBelirtilen yol, oluşturma modu, okuma/yazma ve paylaşım izni, arabellek boyutu, zaman uyumlu veya zaman uyumsuz duruma sahip bir sınıfın yeni bir örneğini başlatır.Initializes a new instance of the FileStream class with the specified path, creation mode, read/write and sharing permission, buffer size, and synchronous or asynchronous state. |
| FileStream(String, FileMode, FileAccess, FileShare, Int32, FileOptions) |
FileStreamBelirtilen yol, oluşturma modu, okuma/yazma ve paylaşma izniyle sınıfın yeni bir örneğini başlatır, diğer FileStreams erişimi aynı dosyaya, arabellek boyutuna ve ek dosya seçeneklerine sahip olabilir.Initializes a new instance of the FileStream class with the specified path, creation mode, read/write and sharing permission, the access other FileStreams can have to the same file, the buffer size, and additional file options. |
| FileStream(String, FileMode, FileSystemRights, FileShare, Int32, FileOptions) |
FileStreamBelirtilen yol, oluşturma modu, erişim hakları ve paylaşım izni, arabellek boyutu ve ek dosya seçenekleri ile sınıfın yeni bir örneğini başlatır.Initializes a new instance of the FileStream class with the specified path, creation mode, access rights and sharing permission, the buffer size, and additional file options. |
| FileStream(String, FileMode, FileSystemRights, FileShare, Int32, FileOptions, FileSecurity) |
FileStreamBelirtilen yol, oluşturma modu, erişim hakları ve paylaşım izni, arabellek boyutu, ek dosya seçenekleri, erişim denetimi ve denetim güvenliği ile sınıfın yeni bir örneğini başlatır.Initializes a new instance of the FileStream class with the specified path, creation mode, access rights and sharing permission, the buffer size, additional file options, access control and audit security. |
Özellikler
| CanRead |
Geçerli akışın okumayı destekleyip desteklemediğini gösteren bir değer alır.Gets a value that indicates whether the current stream supports reading. |
| CanSeek |
Geçerli akışın aramayı destekleyip desteklemediğini gösteren bir değer alır.Gets a value that indicates whether the current stream supports seeking. |
| CanTimeout |
Geçerli akışın zaman aşımına amayacağını belirleyen bir değer alır.Gets a value that determines whether the current stream can time out. (Devralındığı yer: Stream) |
| CanWrite |
Geçerli akışın yazmayı destekleyip desteklemediğini gösteren bir değer alır.Gets a value that indicates whether the current stream supports writing. |
| Handle |
Kullanımdan kalktı.
Kullanımdan kalktı.
Kullanımdan kalktı.
Geçerli nesnenin sarmalayan dosya için işletim sistemi dosya tanıtıcısını alır |
| IsAsync |
|
| Length |
Akışın bayt cinsinden uzunluğunu alır.Gets the length in bytes of the stream. |
| Name |
İçinde açılan dosyanın mutlak yolunu alır |
| Position |
Bu akışın geçerli konumunu alır veya ayarlar.Gets or sets the current position of this stream. |
| ReadTimeout |
Akışın zaman aşımından önce okumayı ne kadar süreyle deneyeceğini belirleyen milisaniye cinsinden bir değer alır veya ayarlar.Gets or sets a value, in milliseconds, that determines how long the stream will attempt to read before timing out. (Devralındığı yer: Stream) |
| SafeFileHandle |
SafeFileHandleGeçerli nesnenin sarmalayan dosya için işletim sistemi dosya tanıtıcısını temsil eden bir nesne alır FileStream .Gets a SafeFileHandle object that represents the operating system file handle for the file that the current FileStream object encapsulates. |
| WriteTimeout |
Akışın zaman aşımından önce ne kadar süreyle yazmaya çalışacağını belirleyen milisaniye cinsinden bir değer alır veya ayarlar.Gets or sets a value, in milliseconds, that determines how long the stream will attempt to write before timing out. (Devralındığı yer: Stream) |
Yöntemler
| BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) |
Zaman uyumsuz okuma işlemi başlatır.Begins an asynchronous read operation. ReadAsync(Byte[], Int32, Int32, CancellationToken)Bunun yerine kullanmayı düşünün.Consider using ReadAsync(Byte[], Int32, Int32, CancellationToken) instead. |
| BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) |
Zaman uyumsuz okuma işlemi başlatır.Begins an asynchronous read operation. ( ReadAsync(Byte[], Int32, Int32) Bunun yerine kullanmayı düşünün.)(Consider using ReadAsync(Byte[], Int32, Int32) instead.) (Devralındığı yer: Stream) |
| BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) |
Zaman uyumsuz yazma işlemine başlar.Begins an asynchronous write operation. WriteAsync(Byte[], Int32, Int32, CancellationToken)Bunun yerine kullanmayı düşünün.Consider using WriteAsync(Byte[], Int32, Int32, CancellationToken) instead. |
| BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) |
Zaman uyumsuz yazma işlemine başlar.Begins an asynchronous write operation. ( WriteAsync(Byte[], Int32, Int32) Bunun yerine kullanmayı düşünün.)(Consider using WriteAsync(Byte[], Int32, Int32) instead.) (Devralındığı yer: Stream) |
| Close() |
Geçerli akışı kapatır ve geçerli akış ile ilişkili tüm kaynakları (yuvalar ve dosya tutamaçları gibi) yayınlar.Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. |
| Close() |
Geçerli akışı kapatır ve geçerli akış ile ilişkili tüm kaynakları (yuvalar ve dosya tutamaçları gibi) yayınlar.Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. Bu yöntemi çağırmak yerine akışın düzgün şekilde atılmış olduğundan emin olun.Instead of calling this method, ensure that the stream is properly disposed. (Devralındığı yer: Stream) |
| CopyTo(Stream) |
Geçerli akıştan baytları okur ve bunları başka bir akışa yazar.Reads the bytes from the current stream and writes them to another stream. (Devralındığı yer: Stream) |
| CopyTo(Stream, Int32) |
Geçerli akıştan baytları okur ve belirtilen arabellek boyutunu kullanarak bunları başka bir akışa yazar.Reads the bytes from the current stream and writes them to another stream, using a specified buffer size. (Devralındığı yer: Stream) |
| CopyToAsync(Stream) |
Geçerli akıştan alınan baytları zaman uyumsuz olarak okur ve bunları başka bir akışa yazar.Asynchronously reads the bytes from the current stream and writes them to another stream. (Devralındığı yer: Stream) |
| CopyToAsync(Stream, CancellationToken) |
Zaman uyumsuz olarak geçerli akıştan bayt okur ve belirtilen bir iptal belirtecini kullanarak bunları başka bir akışa yazar.Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified cancellation token. (Devralındığı yer: Stream) |
| CopyToAsync(Stream, Int32) |
Geçerli akıştan gelen baytları zaman uyumsuz olarak okur ve belirtilen arabellek boyutunu kullanarak bunları başka bir akışa yazar.Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size. (Devralındığı yer: Stream) |
| CopyToAsync(Stream, Int32, CancellationToken) |
Geçerli dosya akışından alınan baytları zaman uyumsuz olarak okur ve belirtilen arabellek boyutunu ve iptal belirtecini kullanarak bunları başka bir akışa yazar.Asynchronously reads the bytes from the current file stream and writes them to another stream, using a specified buffer size and cancellation token. |
| CopyToAsync(Stream, Int32, CancellationToken) |
Zaman uyumsuz olarak geçerli akıştan bayt okur ve belirtilen arabellek boyutunu ve iptal belirtecini kullanarak bunları başka bir akışa yazar.Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token. (Devralındığı yer: Stream) |
| CreateObjRef(Type) |
Uzak bir nesneyle iletişim kurmak için kullanılan bir ara sunucu oluşturmak için gereken tüm bilgileri içeren bir nesne oluşturur.Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Devralındığı yer: MarshalByRefObject) |
| CreateWaitHandle() |
Kullanımdan kalktı.
Bir WaitHandle nesneyi ayırır.Allocates a WaitHandle object. (Devralındığı yer: Stream) |
| Dispose() |
Stream tarafından kullanılan tüm kaynakları serbest bırakır.Releases all resources used by the Stream. (Devralındığı yer: Stream) |
| Dispose(Boolean) |
FileStream tarafından kullanılan yönetilmeyen kaynakları serbest bırakır ve yönetilen kaynakları isteğe bağlı olarak serbest bırakır.Releases the unmanaged resources used by the FileStream and optionally releases the managed resources. |
| DisposeAsync() |
Tarafından kullanılan yönetilmeyen kaynakları zaman uyumsuz olarak bırakır FileStream .Asynchronously releases the unmanaged resources used by the FileStream. |
| DisposeAsync() |
Tarafından kullanılan yönetilmeyen kaynakları zaman uyumsuz olarak bırakır Stream .Asynchronously releases the unmanaged resources used by the Stream. (Devralındığı yer: Stream) |
| EndRead(IAsyncResult) |
Bekleyen zaman uyumsuz okuma işleminin tamamlanmasını bekler.Waits for the pending asynchronous read operation to complete. ( ReadAsync(Byte[], Int32, Int32, CancellationToken) Bunun yerine kullanmayı düşünün.)(Consider using ReadAsync(Byte[], Int32, Int32, CancellationToken) instead.) |
| EndRead(IAsyncResult) |
Bekleyen zaman uyumsuz okuma işleminin tamamlanmasını bekler.Waits for the pending asynchronous read to complete. ( ReadAsync(Byte[], Int32, Int32) Bunun yerine kullanmayı düşünün.)(Consider using ReadAsync(Byte[], Int32, Int32) instead.) (Devralındığı yer: Stream) |
| EndWrite(IAsyncResult) |
Zaman uyumsuz yazma işlemini sonlandırır ve g/ç işlemi tamamlanana kadar blokları engeller.Ends an asynchronous write operation and blocks until the I/O operation is complete. ( WriteAsync(Byte[], Int32, Int32, CancellationToken) Bunun yerine kullanmayı düşünün.)(Consider using WriteAsync(Byte[], Int32, Int32, CancellationToken) instead.) |
| EndWrite(IAsyncResult) |
Zaman uyumsuz yazma işlemini sonlandırır.Ends an asynchronous write operation. ( WriteAsync(Byte[], Int32, Int32) Bunun yerine kullanmayı düşünün.)(Consider using WriteAsync(Byte[], Int32, Int32) instead.) (Devralındığı yer: Stream) |
| Equals(Object) |
Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.Determines whether the specified object is equal to the current object. (Devralındığı yer: Object) |
| Finalize() |
Kaynak serbest bırakılmış ve çöp toplayıcı geri kazanır için diğer temizleme işlemlerinin gerçekleştirilmesini sağlar |
| Flush() |
Bu akış için arabellekleri temizler ve arabelleğe alınan verilerin dosyaya yazılmasına neden olur.Clears buffers for this stream and causes any buffered data to be written to the file. |
| Flush(Boolean) |
Bu akış için arabellekleri temizler ve arabelleğe alınan verilerin dosyaya yazılmasına neden olur ve ayrıca tüm ara dosya arabelleğini temizler.Clears buffers for this stream and causes any buffered data to be written to the file, and also clears all intermediate file buffers. |
| FlushAsync() |
Bu akış için tüm arabellekleri zaman uyumsuz olarak temizler ve arabelleğe alınan verilerin temeldeki cihaza yazılmasına neden olur.Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device. (Devralındığı yer: Stream) |
| FlushAsync(CancellationToken) |
Bu akış için tüm arabellekleri zaman uyumsuz olarak temizlemez, ara belleğe alınan verilerin temeldeki cihaza yazılmasına neden olur ve iptal isteklerini izler.Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests. |
| FlushAsync(CancellationToken) |
Bu akış için tüm arabellekleri zaman uyumsuz olarak temizlemez, ara belleğe alınan verilerin temeldeki cihaza yazılmasına neden olur ve iptal isteklerini izler.Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests. (Devralındığı yer: Stream) |
| GetAccessControl() |
FileSecurityGeçerli nesne tarafından tanımlanan dosya için erişim denetimi listesi (ACL) girdilerini kapsülleyen bir nesne alır FileStream .Gets a FileSecurity object that encapsulates the access control list (ACL) entries for the file described by the current FileStream object. |
| GetHashCode() |
Varsayılan karma işlevi olarak işlev görür.Serves as the default hash function. (Devralındığı yer: Object) |
| GetLifetimeService() |
Kullanımdan kalktı.
Bu örnek için ömür ilkesini denetleyen geçerli ömür hizmeti nesnesini alır.Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Devralındığı yer: MarshalByRefObject) |
| GetType() |
TypeGeçerli örneği alır.Gets the Type of the current instance. (Devralındığı yer: Object) |
| InitializeLifetimeService() |
Kullanımdan kalktı.
Bu örnek için ömür ilkesini denetlemek üzere bir ömür hizmeti nesnesi alır.Obtains a lifetime service object to control the lifetime policy for this instance. (Devralındığı yer: MarshalByRefObject) |
| Lock(Int64, Int64) |
Diğer işlemlerin, okumasını veya öğesine yazmasını engeller FileStream .Prevents other processes from reading from or writing to the FileStream. |
| MemberwiseClone() |
Geçerli bir basit kopyasını oluşturur Object .Creates a shallow copy of the current Object. (Devralındığı yer: Object) |
| MemberwiseClone(Boolean) |
Geçerli nesnenin basit bir kopyasını oluşturur MarshalByRefObject .Creates a shallow copy of the current MarshalByRefObject object. (Devralındığı yer: MarshalByRefObject) |
| ObjectInvariant() |
Kullanımdan kalktı.
İçin destek sağlar Contract .Provides support for a Contract. (Devralındığı yer: Stream) |
| Read(Byte[], Int32, Int32) |
Akıştan bir bayt bloğunu okur ve verileri belirli bir arabelleğe yazar.Reads a block of bytes from the stream and writes the data in a given buffer. |
| Read(Span<Byte>) |
Geçerli dosya akışından bir bayt dizisini okur ve dosya akışı içindeki konumu okunan bayt sayısıyla ilerletir.Reads a sequence of bytes from the current file stream and advances the position within the file stream by the number of bytes read. |
| Read(Span<Byte>) |
Türetilmiş bir sınıfta geçersiz kılınırsa, geçerli akıştan bir bayt dizisini okur ve okunan bayt sayısıyla akış içindeki konumu ilerletir.When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. (Devralındığı yer: Stream) |
| ReadAsync(Byte[], Int32, Int32) |
Zaman uyumsuz olarak geçerli akıştan bir bayt dizisini okur ve okunan bayt sayısıyla akış içindeki konumu ilerletir.Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. (Devralındığı yer: Stream) |
| ReadAsync(Byte[], Int32, Int32, CancellationToken) |
Geçerli dosya akışından bir bayt dizisini zaman uyumsuz olarak okur ve belirtilen bir uzaklığında başlayarak bir bayt dizisine yazar, okunan bayt sayısıyla dosya akışı içindeki konumu ilerletir ve iptal isteklerini izler.Asynchronously reads a sequence of bytes from the current file stream and writes them to a byte array beginning at a specified offset, advances the position within the file stream by the number of bytes read, and monitors cancellation requests. |
| ReadAsync(Byte[], Int32, Int32, CancellationToken) |
Geçerli akıştan bir bayt dizisini zaman uyumsuz olarak okur, okunan bayt sayısıyla akış içindeki konumu ilerletir ve iptal isteklerini izler.Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests. (Devralındığı yer: Stream) |
| ReadAsync(Memory<Byte>, CancellationToken) |
Geçerli dosya akışından bir bayt dizisini zaman uyumsuz olarak okur ve bunları bir bellek bölgesine yazar, dosya akışı içindeki konumu okunan bayt sayısıyla ilerletir ve iptal isteklerini izler.Asynchronously reads a sequence of bytes from the current file stream and writes them to a memory region, advances the position within the file stream by the number of bytes read, and monitors cancellation requests. |
| ReadAsync(Memory<Byte>, CancellationToken) |
Geçerli akıştan bir bayt dizisini zaman uyumsuz olarak okur, okunan bayt sayısıyla akış içindeki konumu ilerletir ve iptal isteklerini izler.Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests. (Devralındığı yer: Stream) |
| ReadByte() |
Dosyadan bir bayt okur ve okuma konumunu bir bayt ilerletir.Reads a byte from the file and advances the read position one byte. |
| Seek(Int64, SeekOrigin) |
Bu akışın geçerli konumunu verilen değere ayarlar.Sets the current position of this stream to the given value. |
| SetAccessControl(FileSecurity) |
FileSecurityGeçerli nesne tarafından tanımlanan dosyaya bir nesne tarafından tanımlanan erişim denetim listesi (ACL) girdilerini uygular FileStream .Applies access control list (ACL) entries described by a FileSecurity object to the file described by the current FileStream object. |
| SetLength(Int64) |
Bu akışın uzunluğunu verilen değere ayarlar.Sets the length of this stream to the given value. |
| ToString() |
Geçerli nesneyi temsil eden dizeyi döndürür.Returns a string that represents the current object. (Devralındığı yer: Object) |
| Unlock(Int64, Int64) |
Daha önce kilitlenen bir dosyanın tamamına veya bir kısmına diğer işlemlerin erişimine izin verir.Allows access by other processes to all or part of a file that was previously locked. |
| Write(Byte[], Int32, Int32) |
Dosya akışına bir bayt bloğu yazar.Writes a block of bytes to the file stream. |
| Write(ReadOnlySpan<Byte>) |
Salt okunurdur bir yayılma alanından geçerli dosya akışına bir bayt dizisi yazar ve bu dosya akışı içindeki geçerli konumu yazılan bayt sayısıyla ilerletir.Writes a sequence of bytes from a read-only span to the current file stream and advances the current position within this file stream by the number of bytes written. |
| Write(ReadOnlySpan<Byte>) |
Türetilmiş bir sınıfta geçersiz kılınırsa, geçerli akışa bir bayt dizisi yazar ve yazılan bayt sayısıyla bu akış içindeki geçerli konumu ilerletir.When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. (Devralındığı yer: Stream) |
| WriteAsync(Byte[], Int32, Int32) |
Zaman uyumsuz olarak geçerli akışa bir bayt dizisi yazar ve yazılan bayt sayısıyla bu akış içindeki geçerli konumu ilerletir.Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. (Devralındığı yer: Stream) |
| WriteAsync(Byte[], Int32, Int32, CancellationToken) |
Zaman uyumsuz olarak geçerli akışa bir bayt dizisi yazar, bu akış içindeki geçerli konumu yazılan bayt sayısıyla ilerletir ve iptal isteklerini izler.Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests. |
| WriteAsync(Byte[], Int32, Int32, CancellationToken) |
Zaman uyumsuz olarak geçerli akışa bir bayt dizisi yazar, bu akış içindeki geçerli konumu yazılan bayt sayısıyla ilerletir ve iptal isteklerini izler.Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests. (Devralındığı yer: Stream) |
| WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) |
Zaman uyumsuz olarak bir bellek bölgesinden bir bayt dizisini geçerli dosya akışına yazar, yazılan bayt sayısıyla bu dosya akışı içindeki geçerli konumu ilerletir ve iptal isteklerini izler.Asynchronously writes a sequence of bytes from a memory region to the current file stream, advances the current position within this file stream by the number of bytes written, and monitors cancellation requests. |
| WriteAsync(ReadOnlyMemory<Byte>, CancellationToken) |
Zaman uyumsuz olarak geçerli akışa bir bayt dizisi yazar, bu akış içindeki geçerli konumu yazılan bayt sayısıyla ilerletir ve iptal isteklerini izler.Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests. (Devralındığı yer: Stream) |
| WriteByte(Byte) |
Dosya akışındaki geçerli konuma bir bayt yazar.Writes a byte to the current position in the file stream. |
Belirtik Arabirim Kullanımları
| IDisposable.Dispose() |
Stream tarafından kullanılan tüm kaynakları serbest bırakır.Releases all resources used by the Stream. (Devralındığı yer: Stream) |
Uzantı Metotları
| GetAccessControl(FileStream) |
Bir dosyanın güvenlik bilgilerini döndürür.Returns the security information of a file. |
| SetAccessControl(FileStream, FileSecurity) |
Mevcut bir dosyanın güvenlik özniteliklerini değiştirir.Changes the security attributes of an existing file. |
| AsInputStream(Stream) |
Windows Mağazası uygulamaları için .NET içindeki yönetilen bir akışı, Windows Çalışma Zamanı giriş akışına dönüştürür.Converts a managed stream in the .NET for Windows Store apps to an input stream in the Windows Runtime. |
| AsOutputStream(Stream) |
Windows Mağazası uygulamaları için .NET içindeki yönetilen bir akışı, Windows Çalışma Zamanı bir çıkış akışına dönüştürür.Converts a managed stream in the .NET for Windows Store apps to an output stream in the Windows Runtime. |
| AsRandomAccessStream(Stream) |
Belirtilen akışı rasgele erişim akışına dönüştürür.Converts the specified stream to a random access stream. |
| ConfigureAwait(IAsyncDisposable, Boolean) |
Zaman uyumsuz bir atılabilir döndürülen görevlerin ne kadar beklediğini yapılandırır.Configures how awaits on the tasks returned from an async disposable are performed. |
Şunlara uygulanır
Ayrıca bkz.
- File
- FileAccess
- FileMode
- FileShare
- Dosya ve Akış G/ÇFile and Stream I/O
- Nasıl yapılır: Dosyadan Metin OkumaHow to: Read Text from a File
- Nasıl yapılır: Bir Dosyaya Metin YazmaHow to: Write Text to a File
- Nasıl yapılır: Yeni Oluşturulan bir Veri Dosyasını Okuma ve Dosyaya YazmaHow to: Read and Write to a Newly Created Data File