I copied this from the "synthesized objectives" posted at Tony Alicea's site: Write code that uses objects of the file class to navigate a file system. Write code that uses objects of the classes InputStreamReader and OutputStreamWriter to translate between Unicode and either platform default or ISO 8859-1 character encodings. Distinguish between conditions under which platform default encoding conversion should be used and conditions under which a specific conversion should be used. Select valid constructor arguments for FilterInputStream and FilterOutputStream subclasses from a list of classes in the java.io.package. Write appropriate code to read, write and update files using FileInputStream, FileOutputStream, and RandomAccessFile objects. Describe the permanent effects on the file system of constructing and using FileInputStream, FileOutputStream, and RandomAccessFile. Well thats quite a mouthful. I've been told that as far as the test goes one should be familiar with the main types of classes, what they are used for and their constructors. I created a little cheat sheet breaking down the categories and sorting them by the types of constructors they use. The whole I/O package can seem very daunting at first but I think this should help: Class (Constructors) File (String) (String parent, String child) (File parent, String child) Remember that a File object is used as a parameter from which the other I/O objects are ultimately built in most cases. So I liked to use this class as my starting point. And of course the File class has a lot of methods for navigating and manipulating the host file system with which you should develop some familiarity. Class (Constructors) FileOutputStream (File) FileInputStream (FileDescriptor) FileReader (String) FileWriter (String, boolean append) - valid for output/ writers only The classes on the left can use any of the constructor arguments on the right except where noted. Just remember if the class starts with the word "File" then any of the constructors mentioned above are valid. BufferedInputStream (InputStream) (InputStream, int size) - where size = buffer size BufferedReader - same as above, just substitute Reader for InputStream. BufferedOutputStream and BufferedWriter same as above, just substitute Output/Writer where appropriate. If the class starts with the word Buffered then use the constructors described above ObjectInputStream (InputStream) DataInputStream FilterInputStream All of the above take an InputStream as the argument for the only constructor available to build such a stream. For the Output streams just substitute Output for Input. All of the remaining streams take constructors as described above with the exception of: InputStreamReader (InputStream) (InputStream, String encoding) again same for OutputStreamWriter (thanks Maha) just substitute Output for Input. Get familiar with the encoding for the ASCII character set. RandomAccessFile (File, String mode) (String name, String mode) values for mode can be "r" or "rw" ONLY! FilterReader and Writer InputStream and OutputStream Reader and Writer All of the above are abstract and cannot be instantiated. I think this should cover the main classes you are likely to see on the exam. Remember you can chain the classes together in lots of cases to build objects of the higher level classes. Hopefully this breakdown should make it easier to get your arms around the subject.
Tony, Jim, anyone else: if you see any glaring errors or omissions please let me know and I will correct it.
[This message has been edited by Joe Java (edited March 12, 2000).] [This message has been edited by Joe Java (edited March 12, 2000).]
Joined: Jan 31, 2000
Joe, Your breakdown of I/O package is really good. One small correction. Just change the OutputStream reader to OutputStreamWriter. There is no class called OutputStreamReader. regds maha anna From Joe's post InputStreamReader (InputStream) (InputStream, String encoding) again same for OutputStream reader just substitute Output for Input. Get familiar with the encoding for the ASCII character set.
[This message has been edited by maha anna (edited March 12, 2000).]
Joined: Mar 01, 2000
This is great Joe. Thanks a lot.
Joined: Nov 22, 2008
Joe, this listing is very helpful! and I appreciate for posting it here. Thanks..