tailieunhanh - Lecture Object Oriented Programing - Chapter 14: Files and streams
In chapter 14 you will learn: To create, read, write and update files; to use class File to retrieve information about files and directories; the Java input/output stream class hierarchy; the differences between text files and binary files; sequential-access and random-access file processing; to use classes Scanner and Formatter to process text files; to use the FileInputStream and FileOutputStream classes. | 14 Files and Streams I can only assume that a “Do Not File” document is filed in a “Do Not File” file. Senator Frank Church Senate Intelligence Subcommittee Hearing, 1975 Consciousness does not appear to itself chopped up in bits. A “river” or a “stream” are the metaphors by which it is most naturally described. William James I read part of it all the way through. Samuel Goldwyn A great memory does not make a philosopher, any more than a dictionary can be called grammar. John Henry, Cardinal Newman OBJECTIVES In this chapter you will learn: To create, read, write and update files. To use class File to retrieve information about files and directories. The Java input/output stream class hierarchy. The differences between text files and binary files. Sequential-access and random-access file processing. To use classes Scanner and Formatter to process text files. To use the FileInputStream and FileOutputStream classes. To use a JFileChooser dialog. To use the ObjectInputStream and | 14 Files and Streams I can only assume that a “Do Not File” document is filed in a “Do Not File” file. Senator Frank Church Senate Intelligence Subcommittee Hearing, 1975 Consciousness does not appear to itself chopped up in bits. A “river” or a “stream” are the metaphors by which it is most naturally described. William James I read part of it all the way through. Samuel Goldwyn A great memory does not make a philosopher, any more than a dictionary can be called grammar. John Henry, Cardinal Newman OBJECTIVES In this chapter you will learn: To create, read, write and update files. To use class File to retrieve information about files and directories. The Java input/output stream class hierarchy. The differences between text files and binary files. Sequential-access and random-access file processing. To use classes Scanner and Formatter to process text files. To use the FileInputStream and FileOutputStream classes. To use a JFileChooser dialog. To use the ObjectInputStream and ObjectOutputStream classes Introduction Data Hierarchy Files and Streams Class File Sequential-Access Text Files Creating a Sequential-Access Text File Reading Data from a Sequential-Access Text File Case Study: A Credit-Inquiry Program Updating Sequential-Access Files Object Serialization Creating a Sequential-Access File Using Object Serialization Reading and Deserializing Data from a Sequential- Access File Additional Classes Opening Files with JFileChooser Wrap-Up Introduction Storage of data in variables and arrays is temporary Files used for long-term retention of large amounts of data, even after the programs that created the data terminate Persistent data – exists beyond the duration of program execution Files stored on secondary storage devices Stream – ordered data that is read from or written to a file Data Hierarchy Computers .
đang nạp các trang xem trước