Danh mục

Lecture Windows programming: Chapter 8 - Châu Thị Bảo Hà

Số trang: 37      Loại file: pptx      Dung lượng: 260.81 KB      Lượt xem: 10      Lượt tải: 0    
Thư viện của tui

Xem trước 4 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Lecture Windows programming - Chapter 8 introduce to the files and streams. In this chapter you will be learn contents: Files and Streams overview, IO namespace and its classes, serialization.
Nội dung trích xuất từ tài liệu:
Lecture Windows programming: Chapter 8 - Châu Thị Bảo HàFiles&StreamsChapter8 Ebook: Beginning Visual C# 2010, chapter 21 Reference: C# How to Program, chapter 17Contents Files and Streams overview IO namespace and its classes SerializationFilesandStreams Files and Streams  C# views each file as a sequential stream of bytes  each file ends either with:  an end-of-file marker  specific byte number  recorded in a system-maintained administrative data structure  When a file is opened, an object is created and a stream is associated with the object when a file is opened  two types of streams  output  inputContents Files and Streams IO namespace and its classes SerializationIOnamespaceanditsclassesClass DescriptionStream Provides a view of the sequence of bytesFile Provides static methods for creating and manipulating filesFileSystemIn Contains methods that are common to file and directoryfo manipulationDirectory Provides methods for creating, moving and enumerating through directories and sub-directoriesDirectoryInfo Provides instance methods for creating, moving and enumerating directories and sub-directoriesTextReader Represents a reader that can read a sequence of charactersTextWriter Represents a writer that can write a sequence of charactersBinaryReade Reads primitive data types as binary values in a specificr encodingBinaryWriter Writes primitive types in binary to a stream and supportsStreamclasses An abstract class from which different classes are derived  MemoryStream  used to read and write data to memory  BufferedStream  used to read and write to the buffer  FileStream  used to perform read and write operations on files  NetworkStream  used to send and receive data across the network  CryptoStream  used to link the stream of data to any cryptography object for the purpose of encrypting the dataFileStreamclassconstructors Constructors DescriptionFileStream(string Takes in the path of the file to beFilePath, FileMode) read from or written to and any one of the FileMode enumerator values as its argumentsFileStream(string Takes in the path of the file to beFilePath, FileMode, read from or written to, any one ofFileAccess) the FileMode enumerator values and FileAccess enumerator values as it argumentsEnumeratorsusedwithFileStreamclass FileMode Enumerators  FileAccess  Append Enumerators  Create  Read  CreateNew  Write  Open  ReadWrite  OpenOrCreate  TruncateDirectoryandFileclasses The directory class contains static methods that help in handling directories and subdirectories The file class contains static methods that help in handling files  it also helps in the creation of FileStream classFilemethods Methods DescriptionCopy( string Used to copy the contents of a source file to aSourcePath, string destination file in the specified path. If theDestinationPath ); destination file does not exist, a new file is created with the specified name in the specified pathCreate( string Path ) Used to create a file with the specified name in the specified pathDelete( string Path ) Used to delete a file from a specified pathExists( string Path ) Used to verify whether a file with the specified name exists in the specified path. It returns a Boolean valueMove( string Used to move the specified file from theSourcePath, string source location to the destination locationDestinationPath )Directorymethods Methods DescriptionCreateDirectory (String Creates all the directories in the specifiedPath) pathDelete( string Path ) Deletes an empty directory from a specified pathExists( string Path ) Checks whether the given path refers to an existing directory on diskMove( string Used to move the specified file from theSourceFilePath, string source location to the destination locationDestinationFilePath )GetCurrentDirectory() Returns the current working directoryGetDirectories ( string Gets the names of subdirectoriesPath)Ge ...

Tài liệu được xem nhiều: