Few weeks back i started reading Java™ How to Program, Sixth Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc.
Nice book written By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc.
I wanted to share few quotations found the book from the 14th chapter.
1) Data stored in variables and arrays is temporarythe data is lost when a local variable goes out of scope or when the program terminates. Computers use files for long-term retention of large amounts of data, even after the programs that created the data terminate.
2) Persistent data maintained in files exists beyond the duration of program execution.
3) Computers store files on secondary storage devices such as hard disks.
4) The smallest data item in a computer can assume the value 0 or the value 1 and is called a bit. Ultimately, a computer processes all data items as combinations of zeros and ones.
5) The computer's character set is the set of all characters used to write programs and represent data.
6) Characters in Java are Unicode characters composed of two bytes, each composed of eight bits.
7) Just as characters are composed of bits, fields are composed of characters or bytes. A field is a group of characters or bytes that conveys meaning.
8) Data items processed by computers form a data hierarchy that becomes larger and more complex in structure as we progress from bits to characters to fields, and so on.
9) Typically, several fields compose a record (implemented as a class in Java).
10) A record is a group of related fields.
11) A file is a group of related records.
12) To facilitate the retrieval of specific records from a file, at least one field in each record is chosen as a record key. A record key identifies a record as belonging to a particular person or entity and is unique to each record.
13) There are many ways to organize records in a file. The most common is called a sequential file, in which records are stored in order by the record-key field.
14) A group of related files is often called a database. A collection of programs designed to create and manage databases is called a database management system (DBMS).
15) Java views each file as a sequential stream of bytes.
16) Every operating system provides a mechanism to determine the end of a file, such as an end-of-file marker or a count of the total bytes in the file that is recorded in a system-maintained administrative data structure.
17) Byte-based streams represent data in binary format.
18) Character-based streams represent data as sequences of characters.
19) Files that are created using byte-based streams are binary files. Files created using character-based streams are text files. Text files can be read by text editors, whereas binary files are read by a program that converts the data to a human-readable format.
20) Java also can associate streams with different devices. Three stream objects are associated with devices when a Java program begins executingSystem.in, System.out and System.err.
21) The java.io package includes definitions for stream classes, such as FileInputStream (for byte-based input from a file), FileOutputStream (for byte-based output to a file), FileReader (for character-based input from a file) and FileWriter (for character-based output to a file). Files are opened by creating objects of these stream classes.
22) Class File is used to obtain information about files and directories.
23) Character-based input and output can be performed with classes Scanner and Formatter.
24) Class Formatter enables formatted data to be output to the screen or to a file in a manner similar to System.out.printf.
25) A file or directory's path specifies its location on disk.
26) An absolute path contains all the directories, starting with the root directory, that lead to a specific file or directory. Every file or directory on a disk drive has the same root directory in its path.
27) A relative path normally starts from the directory in which the application began executing.
28) A separator character is used to separate directories and files in the path.
29) Java imposes no structure on a filenotions such as a record do not exist as part of the Java language. The programmer must structure files to meet an application's requirements.
30) To retrieve data sequentially from a file, programs normally start reading from the beginning of the file and read all the data consecutively until the desired information is found.
31) Data in many sequential files cannot be modified without the risk of destroying other data in the file. Therefore, records in a sequential-access file are not usually updated in place. Instead, the entire file is usually rewritten.
32) Java provides a mechanism called object serialization that enables entire objects to be written to or read from a stream.
33) A serialized object is an object represented as a sequence of bytes that includes the object's data as well as information about the object's type and the types of data stored in the object.
34) After a serialized object has been written into a file, it can be read from the file and deserializedthat is, the type information and bytes that represent the object and its data can be used to recreate the object in memory.
35) Classes ObjectInputStream and ObjectOutputStream, which respectively implement the ObjectInput and ObjectOutput interfaces, enable entire objects to be read from or written to a stream (possibly a file).
36) Only classes that implement interface Serializable can be serialized and deserialized with ObjectOutputStreams and ObjectInputStreams.
37) The ObjectOutput interface contains method writeObject, which takes an Object that implements interface Serializable as an argument and writes its information to an OutputStream.
38) The ObjectInput interface contains method readObject, which reads and returns a reference to an Object from an InputStream. After an object has been read, its reference can be cast to the object's actual type.
39) Instant record access is possible with random-access files and with databases. A program can access individual records of a random-access file directly (and quickly) without searching through other records. Random-access files are sometimes called direct-access files.
40) Several techniques can be used to create random-access files. Perhaps the simplest is to require that all the records in a file be of the same fixed length.
41) Using fixed-length records makes it easy for a program to calculate (as a function of the record size and the record key) the exact location of any record relative to the beginning of the file.
42) When a program associates an object of class RandomAccessFile with a file, the program reads or writes data, beginning at the location in the file specified by the file-position pointer, and manipulates all the data as primitive types.
43) RandomAccessFile method seek positions to the exact location in the file at which a record of information is stored. Method seek sets the file-position pointer to a specific location in the file relative to the beginning of the file.
44) Buffering is an I/O-performance-enhancement technique. With a BufferedOutputStream, each output statement does not necessarily result in an actual physical transfer of data to the output device. Rather, each output operation is directed to a region in memory called a buffer that is large enough to hold the data of many output operations. Actual transfer to the output device is then performed in one large physical output operation each time the buffer fills.
45) With a BufferedInputStream, many "logical" chunks of data from a file are read as one large physical input operation into a memory buffer. As a program requests each new chunk of data, it is taken from the buffer. When the buffer is empty, the next actual physical input operation from the input device is performed to read in the next group of "logical" chunks of data.
46) Class JFileChooser is used to display a dialog that enables users of a program to easily select files from a GUI.
About the Authors
Dr. Harvey M. Deitel, Chairman and Chief Strategy Officer of Deitel & Associates, Inc., has 43 years experience in the computing field, including extensive industry and academic experience. Dr. Deitel earned B.S. and M.S. degrees from the Massachusetts Institute of Technology and a Ph.D. from Boston University. He worked on the pioneering virtual-memory operating-systems projects at IBM and MIT that developed techniques now widely implemented in systems such as UNIX, Linux and Windows XP. He has 20 years of college teaching experience, including earning tenure and serving as the Chairman of the Computer Science Department at Boston College before founding Deitel & Associates, Inc., with his son, Paul J. Deitel. He and Paul are the co-authors of several dozen books and multimedia packages and they are writing many more. With translations published in Japanese, German, Russian, Spanish, Traditional Chinese, Simplified Chinese, Korean, French, Polish, Italian, Portuguese, Greek, Urdu and Turkish, the Deitels' texts have earned international recognition. Dr. Deitel has delivered hundreds of professional seminars to major corporations, academic institutions, government organizations and the military.
Paul J. Deitel, CEO and Chief Technical Officer of Deitel & Associates, Inc., is a graduate of the MIT's Sloan School of Management, where he studied Information Technology. Through Deitel & Associates, Inc., he has delivered Java, C, C++, Internet and World Wide Web courses to industry clients, including IBM, Sun Microsystems, Dell, Lucent Technologies, Fidelity, NASA at the Kennedy Space Center, the National Severe Storm Laboratory, Compaq, White Sands Missile Range, Rogue Wave Software, Boeing, Stratus, Cambridge Technology Partners, Open Environment Corporation, One Wave, Hyperion Software, Adra Systems, Entergy, CableData Systems and many other organizations. Paul is one of the most experienced Java corporate trainers having taught about 100 professional Java training courses. He has also lectured on C++ and Java for the Boston Chapter of the Association for Computing Machinery. He and his father, Dr. Harvey M. Deitel, are the world's best-selling Computer Science textbook authors.
Tuesday, 17 February 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment