File Operations, c ++ File Operations

Source: Internet
Author: User

File Operations, c ++ File Operations

File and folder operations mainly use the following classes:

1. File class: usedCreate, copy, delete, move, and open a fileAnd help create a FileStream object.

Http://msdn.microsoft.com/zh-cn/library/system.io.file (v = VS.80). aspx

2. FileInfo class: you only need to provide the instance method. Http://msdn.microsoft.com/zh-cn/library/system.io.fileinfo (v = VS.80). aspx

3. Directory class: usedCreate, move, and enumerate directories and subdirectoriesStatic method.

Msdn: http://msdn.microsoft.com/zh-cn/library/system.io.directory.aspx

4. DirectoryInfo class: you only need to provide the instance method.

Msdn: http://msdn.microsoft.com/zh-cn/library/system.io.directoryinfo.aspx

 

 

  • Directory class: The following are methods copied from msdn.

CreateDirectory (String) creates all directories and subdirectories in the specified path unless they already exist.

CreateDirectory (String, DirectorySecurity) creates all directories (unless they already exist) in the specified path and applies the specified Windows security.

Delete (String) deletes an empty directory from the specified path.

Move (String, String) to Move the file or directory and its content to a new location.

Delete (String, Boolean) deletes the specified directory, and deletes all subdirectories and files in the directory (if indicated ).

Exists (String) determines whether the specified path references the existing directory on the disk.

GetAccessControl (String) gets the DirectorySecurity object, which encapsulates the access control list (ACL) item of the specified directory.

GetAccessControl (String, AccessControlSections) obtains a DirectorySecurity object, which encapsulates the specified type of access control list (ACL) entries in the specified directory.

SetAccessControl (String, DirectorySecurity) applies the access control list (ACL) entry described by the DirectorySecurity object to the specified directory.

GetCreationTime (String) obtains the Directory creation date and time.

SetCreationTime (String, DateTime) is used to set the creation date and time for the specified file or directory.

GetCurrentDirectory () gets the current working directory of the application.

SetCurrentDirectory (String) sets the current working directory of the application to the specified directory.

GetDirectories (String) returns the name (including its path) of the subdirectory in the specified directory ).

GetDirectories (String, String) returns the name (including its path) of the subdirectory that matches the specified search mode in the specified directory ).

GetDirectories (String, String, SearchOption) returns the name (including its path) of the subdirectory that matches the specified search mode in the specified directory. You can also select to search for the subdirectory.

GetDirectoryRoot (String) returns the volume information, root information, or both of the specified paths.

GetFiles (String) returns the name of the file in the specified directory (including its path ).

GetFiles (String, String) returns the name (including the path) of the file in the specified directory that matches the specified search mode ).

GetFiles (String, String, SearchOption) returns the name of the file (including its path) that matches the specified search mode in the specified directory, and uses a value to determine whether to search for the subdirectory.

GetFileSystemEntries (String) returns the names of all files and subdirectories in the specified path.

GetFileSystemEntries (String, String) returns an array of file names and directory names that match the search mode in the specified path.

GetFileSystemEntries (String, String, SearchOption) returns an array of all file names and directory names matching the search mode in the specified path. You can also search for subdirectories.

GetLastAccessTime (String) returns the date and time of the last access to the specified file or directory.

SetLastAccessTime (String, DateTime) sets the date and time of the last access to the specified file or directory.

GetLastWriteTime (String) returns the date and time when the specified file or directory was last written.

SetLastWriteTime (String, DateTime) sets the date and time of the last written directory.

GetLogicalDrives () retrieves the name of the logical drive in the format of "<drive letter >:\" on this computer.

GetParent (String) retrieves the parent directory of the specified path, including the absolute path and relative path.

=========================

SetLastAccessTimeUtc (String, DateTime) sets the date and time of the last access to the specified file or directory. The format is Coordinated Universal Time (UTC ).

SetLastWriteTimeUtc (String, DateTime) sets the date and time of the last write to a directory. The format is Coordinated Universal Time (UTC ).

GetCreationTimeUtc (String) obtains the date and time when the directory is created. The format is Coordinated Universal Time (UTC ).

EnumerateDirectories (String) returns the enumerated set of directory names in the specified path.

EnumerateDirectories (String, String) returns the enumerated set of directory names that match the search mode in the specified path.

EnumerateDirectories (String, String, SearchOption) returns an enumerative set of directory names that match the search mode in the specified path. You can also search for subdirectories.

EnumerateFiles (String) returns the enumerated set of file names in the specified path.

EnumerateFiles (String, String) returns an enumerative set of file names that match the search mode in the specified path.

EnumerateFiles (String, String, SearchOption) returns the enumerated set of file names that match the search mode in the specified path, and you can also search for subdirectories.

EnumerateFileSystemEntries (String) returns an enumerative set of file names and directory names in the specified path.

EnumerateFileSystemEntries (String, String) returns an enumerative set of file names and directory names that match the search mode in the specified path.

EnumerateFileSystemEntries (String, String, SearchOption) returns the enumerated set of file names and directory names that match the search mode in the specified path, and searches for subdirectories.

GetLastWriteTimeUtc (String) returns the date and time when the specified file or directory was last written. The format is Coordinated Universal Time (UTC ).

GetLastAccessTimeUtc (String) returns the date and time of the last access to the specified file or directory. The format is Coordinated Universal Time (UTC ).

SetCreationTimeUtc (String, DateTime) sets the creation date and time of the specified file or directory. The format is Coordinated Universal Time (UTC ).

  • File

AppendAllLines (String, IEnumerable <String>) to append rows to a file, and then close the file. If the specified file does not exist, this method creates a file, writes the specified row to it, and closes the file.
AppendAllLines (String, IEnumerable <String>, Encoding) append rows to a file using the specified Encoding, and then close the file. If the specified file does not exist, this method creates a file, writes the specified row to it, and closes the file.
AppendAllText (String, String) open a file, append the specified String to it, and then close the file. If the file does not exist, this method creates a file, writes the specified string to the file, and closes the file.

AppendAllText (String, String, Encoding) append the specified String to the file. If the file does not exist, create the file.
AppendText (String) creates a StreamWriter that appends the UTF-8-encoded text to an existing or new file (if the specified file does not exist ).

Copy (String, String) copies an existing file to a new file. Files with the same name cannot be overwritten.
Copy (String, String, Boolean) copies an existing file to a new file. The file with the same name can be overwritten.

Create (String) creates or overwrites a file in a specified path.
Create (String, Int32) creates or overwrites the specified file.
Create (String, Int32, FileOptions) to Create or overwrite a specified file, specify the buffer size, and a FileOptions value that describes how to Create or overwrite the file.
Create (String, Int32, FileOptions, FileSecurity) creates or overwrites a specified file with the specified buffer size, file options, and file security.
CreateText (String) creates or opens a file for writing UTF-8-encoded text.

Decrypt (String) uses the Encrypt method to Decrypt files encrypted by the current account.
Delete (String) deletes the specified object.
Encrypt (String) encrypts a file so that only the account that encrypts the file can decrypt it.
Exists (String) determines whether the specified file Exists.

GetAccessControl (String) gets a FileSecurity object, which encapsulates the access control list (ACL) entries of the specified file.
GetAccessControl (String, AccessControlSections) obtains a FileSecurity object and encapsulates the specified type of access control list (ACL) items of a specific file.
GetAttributes (String) gets the FileAttributes of the file on this path.
GetCreationTime (String) returns the creation date and time of the specified file or directory.
GetCreationTimeUtc (String) returns the creation date and time of the specified file or directory. The format is Coordinated Universal Time (UTC ).
GetLastAccessTime (String) returns the date and time of the last access to the specified file or directory.
GetLastAccessTimeUtc (String) returns the date and time of the last access to the specified file or directory. The format is Coordinated Universal Time (UTC ).
GetLastWriteTime (String) returns the date and time when the specified file or directory was last written.
GetLastWriteTimeUtc (String) returns the date and time when the specified file or directory was last written. The format is Coordinated Universal Time (UTC ).

Move (String, String) moves the specified file to a new location and provides the option to specify a new file name.
Open (String, FileMode) opens the FileStream in the specified path with the read/write access permission.
Open (String, FileMode, FileAccess) opens the FileStream in the specified path in the specified mode and access permission.
Open (String, FileMode, FileAccess, FileShare) opens the FileStream in the specified path. It has the specified mode with read, write, or read/write access and specified sharing options.
OpenRead (String) open an existing file for reading.
OpenText (String) opens an existing UTF-8 encoded text file for reading.
OpenWrite (String) open an existing file or create a new file for writing.

ReadAllBytes (String) open a binary file, read the file content into a byte array, and then close the file.
ReadAllLines (String) open a text file, read all the lines of the file, and then close the file.
ReadAllLines (String, Encoding) open a file, read all lines of the file using the specified Encoding, and then close the file.
ReadAllText (String) open a text file, read all the lines of the file, and then close the file.
ReadAllText (String, Encoding) opens a file, reads all lines of the file using the specified Encoding, and closes the file.
The row that ReadLines (String) reads the file.
ReadLines (String, Encoding) reads the row of the object with the specified Encoding.

Replace (String, String, String) replaces the content of a specified file with the content of another file. This process deletes the original file and creates a backup of the replaced file.
Replace (String, Boolean) replaces the content of a specified file with the content of another file. This process deletes the original file and creates a backup of the replaced file, you can also ignore merge errors.
SetAccessControl (String, FileSecurity) applies the access control list (ACL) item described by the FileSecurity object to the specified file.
SetAttributes (String, FileAttributes) obtains the specified FileAttributes of files in the specified path.
SetCreationTime (String, DateTime) sets the date and time when the file was created.
SetLastAccessTime (String, DateTime) sets the date and time of the last access to the specified file.
SetLastWriteTime (String, DateTime) sets the date and time when the specified file was last written.

WriteAllBytes (String, Byte []) creates a new file, writes the specified Byte array to it, and closes the file. If the target file already exists, overwrite the file.
WriteAllLines (String, IEnumerable <String>) creates a new file, writes a String set to it, and closes the file.
WriteAllLines (String, IEnumerable <String>, Encoding) creates a new file using the specified Encoding, writes a String set to it, and closes the file.
WriteAllLines (String, String []) creates a new file, writes the specified byte array to it, and closes the file.
WriteAllLines (String, String [], Encoding) creates a new file, writes the specified String Array in it using the specified Encoding, and closes the file.
WriteAllText (String, String) creates a new file, writes the specified String to it, and closes the file. If the target file already exists, overwrite the file.
WriteAllText (String, String, Encoding) creates a new file, writes the specified String to it using the specified Encoding, and closes the file. If the target file already exists, overwrite the file.

===========================================================

SetCreationTimeUtc (String, DateTime) sets the date and time when the file is created. The format is Coordinated Universal Time (UTC ).
SetLastAccessTimeUtc (String, DateTime) sets the date and time of the last access to the specified file. The format is Coordinated Universal Time (UTC ).
SetLastWriteTimeUtc (String, DateTime) sets the date and time of the last time the specified file is written. The format is Coordinated Universal Time (UTC ).

Path class

ChangeExtension (String, String) changes the extension of the path String.
Combine (String, String) combines two strings into a path.
Combine (String, String, String) combines the three strings into a path.
Combine (String, String) combines the four strings into a path.
Combine (String []) combines String arrays into a path.

GetDirectoryName (String) returns the directory information of the specified path String.
GetExtension (String) returns the extension of the specified path String.
GetFileName (String) returns the name and extension of the specified path String.
GetFileNameWithoutExtension (String) returns the name of a specified path String without an extension.
GetFullPath (String) returns the absolute path of the specified path String.
GetInvalidFileNameChars () gets an array containing characters not allowed in the file name.
GetInvalidPathChars () is used to obtain an array containing characters that are not allowed in the path name.
GetPathRoot (String) obtains the root directory information of the specified path.
GetRandomFileName () returns the random folder name or file name.
GetTempFileName () creates a zero-byte temporary file with a unique magnetic name on the disk and returns the complete path of the file.
GetTempPath () returns the path of the temporary folder of the current user.
HasExtension (String) determines whether the path includes the file extension.
IsPathRooted (String) gets a value that indicates whether the specified path String contains the root.

 

  • FileStream class

BeginRead (Byte [], Int32, Int32, AsyncCallback, Object) starts asynchronous read operations. (To use ReadAsync for replacement, see the "Remarks" section .) (Overwrite Stream. BeginRead (Byte [], Int32, Int32, AsyncCallback, Object ).)
BeginWrite (Byte [], Int32, Int32, AsyncCallback, Object) starts asynchronous write operations. (Consider using WriteAsync for replacement. See the "Remarks" section .) (Overwrite Stream. BeginWrite (Byte [], Int32, Int32, AsyncCallback, Object ).)
Close () closes the current stream and releases all associated resources (such as sockets and file handles ). Instead of calling this method directly, ensure that the stream is correctly released. (Inherited from Stream .)
CopyTo (Stream) reads bytes from the current Stream and writes them to another class. (Inherited from Stream .)
CopyTo (Stream, Int32) uses the specified buffer size to read bytes from the current Stream and write them to another class. (Inherited from Stream .)
CopyToAsync (Stream) asynchronously reads bytes from the current Stream and writes them to another Stream. (Inherited from Stream .)
CopyToAsync (Stream, Int32) uses the specified buffer size to asynchronously read bytes from the current Stream and write them to another class. (Inherited from Stream .)
CopyToAsync (Stream, Int32, CancellationToken) asynchronously reads bytes from the current Stream and writes them to another Stream using the specified buffer size and cancellation token. (Inherited from Stream .)
CreateObjRef (Type) creates an object that contains all the relevant information required to generate a proxy for communication with a remote object. (Inherited from MarshalByRefObject .)
System_CAPS_protmethod CreateWaitHandle () is out of date. Assign a WaitHandle object. (Inherited from Stream .)
Dispose () releases all resources used by Stream. (Inherited from Stream .)
System_CAPS_protmethod Dispose (Boolean) releases the unmanaged resources occupied by FileStream and releases the managed resources. (Override Stream. Dispose (Boolean ).)
EndRead (IAsyncResult) waits for the pending asynchronous read operation to be completed. (To use ReadAsync for replacement, see the "Remarks" section .) (Overwrite Stream. EndRead (IAsyncResult ).)
EndWrite (IAsyncResult) ends the asynchronous write operation and stops the operation until the I/O operation is complete. (Consider using WriteAsync for replacement. See the "Remarks" section .) (Overwrite Stream. EndWrite (IAsyncResult ).)
Equals (Object) determines whether the specified Object is equal to the current Object. (Inherited from Object .)
System_CAPS_protmethod Finalize () ensures that the Garbage Collector releases resources and performs other cleanup operations when recycling FileStream. (Overwrite Object. Finalize ().)
Flush () clears the buffer of this stream so that all buffered data is written to the file. (Overwrite Stream. Flush ().)
Flush (Boolean) clears the buffer of this stream, writes all buffered data to the file, and clears all intermediate file buffers.
FlushAsync () asynchronously clears all buffers of the stream and causes all buffered data to be written to the base device. (Inherited from Stream .)
FlushAsync (CancellationToken) asynchronously clears all the buffers of the stream, writes all buffered data to the basic device, and monitors cancel requests. (Overwrite Stream. FlushAsync (CancellationToken ).)
GetAccessControl () gets the FileSecurity object, which encapsulates the access control list (ACL) of the file described by the current FileStream object.
GetHashCode () is the default hash function. (Inherited from Object .)
GetLifetimeService () retrieves the service object for the current lifetime, which is used to control the lifetime policy of this instance. (Inherited from MarshalByRefObject .)
GetType () gets the Type of the current instance. (Inherited from Object .)
InitializeLifetimeService () gets the lifetime policy that uses the lifetime service object to control this instance. (Inherited from MarshalByRefObject .)
Lock (Int64, Int64) prevents other processes from reading or writing FileStream.
System_CAPS_protmethod MemberwiseClone () creates a superficial copy of the current Object. (Inherited from Object .)
System_CAPS_protmethod MemberwiseClone (Boolean) creates the current superficial copy alalbyrefobject object. (Inherited from MarshalByRefObject .)
System_CAPS_protmethod ObjectInvariant () is out of date. This API supports the product infrastructure and should not be used directly from the code. Supports Contract. (Inherited from Stream .)
Read (Byte [], Int32, Int32) reads bytes from the stream and writes the data to the given buffer. (Overwrite Stream. Read (Byte [], Int32, Int32 ).)
ReadAsync (Byte [], Int32, Int32) asynchronously reads the Byte sequence from the current stream and increases the number of bytes read from the position in the stream. (Inherited from Stream .)
ReadAsync (Byte [], Int32, Int32, CancellationToken) asynchronously reads the sequence of bytes from the current stream, increases the number of bytes read from the position in the stream, and monitors cancel requests. (Overwrite Stream. ReadAsync (Byte [], Int32, Int32, CancellationToken ).)
ReadByte () reads one byte from the file and increases the reading position by one byte. (Overwrite Stream. ReadByte ().)
Seek (Int64, SeekOrigin) sets the current position of the stream to a specified value. (Overwrite Stream. Seek (Int64, SeekOrigin ).)
SetAccessControl (FileSecurity) applies the access control list (ACL) item described by the FileSecurity object to the file described by the current FileStream object.
SetLength (Int64) sets the stream length to a specified value. (Overwrite Stream. SetLength (Int64 ).)
ToString () returns the string representing the current object. (Inherited from Object .)
Unlock (Int64, Int64) allows other processes to access all or part of a previously locked file.
Write (Byte [], Int32, Int32) writes bytes to the file stream. (Overwrite Stream. Write (Byte [], Int32, Int32 ).)
WriteAsync (Byte [], Int32, Int32) asynchronously writes the Byte sequence to the current stream, and increases the number of bytes written to the current position of the stream. (Inherited from Stream .)
WriteAsync (Byte [], Int32, Int32, CancellationToken) asynchronously writes the Byte sequence to the current stream, moves the number of bytes written to the current position in the stream forward, and monitors cancel requests. (Overwrite Stream. WriteAsync (Byte [], Int32, Int32, CancellationToken ).)
WriteByte (Byte) the current position of a Byte written to the file stream. (Overwrite Stream. WriteByte (Byte ).)

 

  • StreamWriter class

Close () closes the current StreamWriter object and basic stream. (Overwrite TextWriter. Close ().)
CreateObjRef (Type) creates an object that contains all the relevant information required to generate a proxy for communication with a remote object. (Inherited from MarshalByRefObject .)
Dispose () releases all resources used by the TextWriter object. (Inherited from TextWriter .)
Dispose (Boolean) releases the unmanaged resources occupied by StreamWriter, and can release the managed resources again. (Overwrite TextWriter. Dispose (Boolean ).)
Equals (Object) determines whether the specified Object is equal to the current Object. (Inherited from Object .)
Finalize () allows an object to try to release resources and perform other cleanup operations before garbage collection. (Inherited from Object .)
Flush () clears all the buffers of the current writer and writes all the buffered data to the base stream. (Overwrite TextWriter. Flush ().)
FlushAsync () asynchronously clears all buffers of the stream and causes all buffered data to be written to the base device. (Overwrite TextWriter. FlushAsync ().)
GetHashCode () is the default hash function. (Inherited from Object .)
GetLifetimeService () retrieves the service object for the current lifetime, which is used to control the lifetime policy of this instance. (Inherited from MarshalByRefObject .)
GetType () gets the Type of the current instance. (Inherited from Object .)
InitializeLifetimeService () gets the lifetime policy that uses the lifetime service object to control this instance. (Inherited from MarshalByRefObject .)
MemberwiseClone () creates a superficial copy of the current Object. (Inherited from Object .)
MemberwiseClone (Boolean) creates the current superficial copy of The MarshalByRefObject object. (Inherited from MarshalByRefObject .)
ToString () returns the string representing the current object. (Inherited from Object .)
Write (Boolean) writes the text representation of a Boolean value to a text string or stream. (Inherited from TextWriter .)
Write (Char) writes characters to the stream. (Overwrite TextWriter. Write (Char ).)
Write (Char []) writes the character array to the stream. (Overwrite TextWriter. Write (Char []).)
Write (Char [], Int32, Int32) writes the sub-array of characters to the stream. (Overwrite TextWriter. Write (Char [], Int32, Int32 ).)
Write (Decimal) writes the text representation of the Decimal value to a text string or stream. (Inherited from TextWriter .)
Write (Double) writes the text representation of an 8-byte floating point value to a text string or stream. (Inherited from TextWriter .)
Write (Int32) writes a 4-byte signed integer text representation to a text string or stream. (Inherited from TextWriter .)
Write (Int64) writes an 8-byte signed integer text representation to a text string or stream. (Inherited from TextWriter .)
Write (Object) writes the text representation of the Object to a text string or stream by calling the ToString method on the Object. (Inherited from TextWriter .)
Write (Single) writes a 4-byte floating point value text representation to a text string or stream. (Inherited from TextWriter .)
Write (String) writes the String to the stream. (Overwrite TextWriter. Write (String ).)
Write (String, Object) uses the same semantics as the String. Format (String, Object) method to Write formatted strings and new lines to text strings or streams. (Inherited from TextWriter .)
Write (String, Object, Object) uses the same semantics as the String. Format (String, Object, Object) method to Write formatted strings and new lines to text strings or streams. (Inherited from TextWriter .)
Write (String, Object) uses the same semantics as the String. Format (String, Object) method to Write the formatted String and the new row into the text String or stream. (Inherited from TextWriter .)
Write (String, Object []) uses the same semantics as the String. Format (String, Object []) method to Write formatted strings and new rows to text strings or streams. (Inherited from TextWriter .)
Write (UInt32) writes a 4-byte unsigned integer text representation to a text string or stream. (Inherited from TextWriter .)
Write (UInt64) writes an 8-byte unsigned integer text representation to a text string or stream. (Inherited from TextWriter .)
WriteAsync (Char) asynchronously writes characters to the stream. (Overwrite TextWriter. WriteAsync (Char ).)
WriteAsync (Char []) asynchronously writes the character array to the next string or stream. (Inherited from TextWriter .)
WriteAsync (Char [], Int32, Int32) asynchronously writes the child array of the character to the stream. (Overwrite TextWriter. WriteAsync (Char [], Int32, Int32 ).)
WriteAsync (String) asynchronously writes a String to the stream. (Overwrite TextWriter. WriteAsync (String ).)
WriteLine () writes the string of the row terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Boolean) writes the text representation of the Boolean value followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Char) writes characters followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Char []) writes an array of characters followed by the row terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Char [], Int32, Int32) writes a child array of characters followed by the row terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Decimal) writes the text representation of the Decimal value followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Double) writes the text representation of the 8-byte floating point value followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Int32) writes a 4-byte signed integer text representation followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Int64) writes an 8-byte signed integer text representation followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (Object) writes the text representation of this Object followed by the row terminator to a text string or stream by calling the ToString method on the Object. (Inherited from TextWriter .)
WriteLine (Single) writes the text representation of the 4-byte floating point value followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (String) writes a String followed by a line terminator to a text String or stream. (Inherited from TextWriter .)
WriteLine (String, Object) uses the same semantics as the String. Format (String, Object) method to write the formatted String and the new row into the text String or stream. (Inherited from TextWriter .)
WriteLine (String, Object, Object) uses the same semantics as String. Format (String, Object, Object) to write formatted strings and new lines to text strings or streams. (Inherited from TextWriter .)
WriteLine (String, Object) uses the same syntax as Format to write formatted strings and a new line. (Inherited from TextWriter .)
WriteLine (String, Object []) uses the same syntax as Format to write formatted strings and a new line. (Inherited from TextWriter .)
WriteLine (UInt32) writes a 4-byte unsigned integer text representation followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLine (UInt64) writes an 8-byte unsigned integer text representation followed by the line terminator to a text string or stream. (Inherited from TextWriter .)
WriteLineAsync () asynchronously writes the row terminator to the stream. (Overwrite TextWriter. WriteLineAsync ().)
WriteLineAsync (Char) asynchronously writes the character followed by the line terminator to the stream. (Overwrite TextWriter. WriteLineAsync (Char ).)
WriteLineAsync (Char []) asynchronously writes an array of characters followed by the row terminator to a text string or stream. (Inherited from TextWriter .)
WriteLineAsync (Char [], Int32, Int32) asynchronously writes the subarray of characters followed by the line terminator to the stream. (Overwrite TextWriter. WriteLineAsync (Char [], Int32, Int32 ).)
WriteLineAsync (String) asynchronously writes the String followed by the line terminator to the stream. (Overwrite TextWriter. WriteLineAsync (String ).)

 

 

 

  • StreamReader class

Close () closes StreamReader objects and basic streams, and releases all system resources associated with the reader. (Overwrite TextReader. Close ().)
CreateObjRef (Type) creates an object that contains all the relevant information required to generate a proxy for communication with a remote object. (Inherited from MarshalByRefObject .)
DiscardBufferedData () clears the internal buffer.
Dispose () releases all resources used by the TextReader object. (Inherited from TextReader .)
Dispose (Boolean) disables the basic stream, releases the unmanaged resources used by StreamReader, and releases the managed resources as needed. (Overwrite TextReader. Dispose (Boolean ).)
Equals (Object) determines whether the specified Object is equal to the current Object. (Inherited from Object .)
Finalize () allows an object to try to release resources and perform other cleanup operations before garbage collection. (Inherited from Object .)
GetHashCode () is the default hash function. (Inherited from Object .)
GetLifetimeService () retrieves the service object for the current lifetime, which is used to control the lifetime policy of this instance. (Inherited from MarshalByRefObject .)
GetType () gets the Type of the current instance. (Inherited from Object .)
InitializeLifetimeService () gets the lifetime policy that uses the lifetime service object to control this instance. (Inherited from MarshalByRefObject .)
MemberwiseClone () creates a superficial copy of the current Object. (Inherited from Object .)
MemberwiseClone (Boolean) creates the current superficial copy of The MarshalByRefObject object. (Inherited from MarshalByRefObject .)
Peek () returns the next available character, but does not use it. (Overwrite TextReader. Peek ().)
Read () reads the next character in the input stream and promotes the character position to one character. (Overwrite TextReader. Read ().)
Read (Char [], Int32, Int32) reads the specified maximum number of characters from the current stream to the buffer zone starting from the specified index position. (Overwrite TextReader. Read (Char [], Int32, Int32 ).)
ReadAsync (Char [], Int32, Int32) asynchronously reads the specified maximum character from the current stream and writes the data to the buffer starting from the specified index position. (Overwrite TextReader. ReadAsync (Char [], Int32, Int32 ).)
ReadBlock (Char [], Int32, Int32) reads the specified maximum number of characters from the current stream and writes the data to the buffer starting from the specified index position. (Overwrite TextReader. ReadBlock (Char [], Int32, Int32 ).)
ReadBlockAsync (Char [], Int32, Int32) asynchronously reads the specified maximum character from the current stream and writes the data to the buffer starting from the specified index position. (Overwrite TextReader. ReadBlockAsync (Char [], Int32, Int32 ).)
ReadLine () reads a line of characters from the current stream and returns the data as a string. (Overwrite TextReader. ReadLine ().)
ReadLineAsync () asynchronously reads a line of characters from the current stream and returns the data as a string. (Overwrite TextReader. ReadLineAsync ().)
ReadToEnd () reads all characters from the current position of the stream to the end. (Overwrite TextReader. ReadToEnd ().)
ReadToEndAsync () asynchronously reads all characters from the current position of the stream to the end and returns them as a string. (Overwrite TextReader. ReadToEndAsync ().)
ToString () returns the string representing the current object. (Inherited from Object .)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.