It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes IO ?????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "IO ??????" Watch "IO ??????" New topic

IO ??????

anamika sharma

Joined: Oct 31, 2000
Posts: 5
Can anybody give me the list of IO constructors.In RHE there are
so many given.I am getting confused and ending up learning nothing.Please help :-(!!!
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Anamika,
I haven't run across any such list on the web; you could try writing one up just for the classes listed in the Sun IO tutorial.
I'm moving this post over to Certification Study .. maybe someone else has a list.

Jane Griscti
Sun Certified Java 2 Programmer
"When ideas fail, words come in very handy" -- Goethe

Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Latha Kalaga
Ranch Hand

Joined: Nov 13, 2000
Posts: 96
Hi! Anamika
Unfortunately, that chapter is very big . However the Inheritance hierarchy diagrams given in Khalid helps a lot. If you have that book, try by memorizing that diagram and then each of those classes will have their corresponding constructors. This helps quite a bit.
Also Khalid covers this chapter much better and in more detail than RHE.
Originally posted by anamika sharma:
Can anybody give me the list of IO constructors.In RHE there are
so many given.I am getting confused and ending up learning nothing.Please help :-(!!!

Raj Dev

Joined: Oct 11, 2000
Posts: 17
Hi Anamika,
Here is the list of constructors, I used the study notes of
Velmurgan. These notes are very useful.

Constructors for some common streams, reader and writers:
FileInputStream(String name) throws FileNotFoundException
FileInputStream(File file) throws FileNotFoundException
FileInputStream(FileDescriptor fdObj)
FileOutputStream(String name) throws FileNotFoundException
FileOutputStream(String name, boolean append) throws FileNotFoundException
FileOutputStream (File file) throws FileNotFoundException
FileOutputStream (FileDescriptor fdObj)
DataInputStream(InputStream in)
DataOutputStream(OutputStream out)
BufferedInputStream(InputStream in)
BufferedInputStream(InputStream in, int size)
BufferedOutputStream(OutputStream out)
BufferedOutputStream(OutputStream out, int size)
FileReader(File file) throws FileNotFoundException
FileReader (FileDescriptor fdObj)
FileReader (String name) throws FileNotFoundException
FileWriter(File file) throws IOException
FileWriter(String name) throws IOException
FileWriter(String name, boolean append) throws IOException
FileWriter(FileDescriptor fdObj)
InputStreamReader(InputStream in)
InputStreamReader(InputStream in, String encodingName) throws UnsupportedEncodingException
OutputStreamWriter(OutputStream out)
OutputStreamWriter (OutputStream out, String encodingName) throws UnsupportedEncodingException
PrintWriter(Writer out)
PrintWriter(Writer out, boolean autoflush)
PrintWriter(OutputStream out)
PrintWriter(OutputStream out, boolean autoflush)
BufferedReader(Reader in)
BufferedReader(Reader in, int size)
BufferedWriter(Writer out)
BufferedWriter (Writer out, int size)

Encoding NameCharacter Set Name
8859_1ISO Latin-1 (subsumes ASCII)
8859_2ISO Latin-2
8859_3ISO Latin-3
8859_4ISO Latin / Cyrillic
UTF8Standard UTF-8 (subsumes ASCII)
OutputStreamWriter and InputStreamReader are the only ones where you can specify an encoding scheme apart from the default encoding scheme of the host system. getEncoding method can be used to obtain the encoding scheme used.
 With UTF-8 Normal ASCII characters are given 1 byte. All Java characters can be encoded with at most 3 bytes, never more.
 All of the streams--readers, writers, input streams, and output streams--are automatically opened when created. You can close any stream explicitly by calling its close method. Or the garbage collector can implicitly close it, which occurs when the object is no longer referenced.
 Closing the streams automatically flushes them. You can also call flush method.
 New FileWriter(�filename�) or FileOutputStream(�filename�) will overwrite if �filename� is existing or create a new file, if not existing. But we can specify the append mode in the second argument.
 Print writers provide the ability to write textual representations of Java primitive values. They have to be chained to the low-level streams or writers. Methods in this class never throw an IOException.
PrintStream and PrintWriter classes can be created with autoflush feature, so that each println method will automatically be written to the next available stream. PrintStream is deprecated.(though System.out and System.err are still of this type)
 is of InputStream type.
, System.out, System.err are automatically created for a program, by JVM.
 Use buffered streams for improving performance.BufferedReader provides readLine method.
 User defined classes must implement Serializable or Externalizable interfaces to be serialized.
 Serializable is a marker interface with no methods. Externalizable has two methods to be implemented � readExternal(ObjectInput) and writeExternal(ObjectOutput).
ObjectOutputStream can write both Java Primitives and Object hierarchies. When a compound object is serialized all its constituent objects that are serializable are also serialized.
ObjectOutputStream implements ObjectOutput, which inherits from DataOutput.
 All AWT components implement Serializable (Since Component class implements it), so by default we can just use an ObjectOutputStream to serialize any AWT component.

 File class is used to navigate the file system.
 Constructing a File instance (or Garbage-Collecting it) never affects the file system.
 File class doesn�t have a method to change the current working directory.
 File constructors
File(File dir, String name)
Creates a File instance that represents the file with the specified name in the specified directory
File(String path)
Creates a File instance that represents the file whose pathname is the given path argument.
File(String path, String name)Creates a File instance whose pathname is the pathname of the specified directory, followed by the separator character, followed by the name argument.

Sun Certified Java 2 Programmer<P><img> </img>
anamika sharma

Joined: Oct 31, 2000
Posts: 5
THANX!!! Rajdev
I agree. Here's the link:
subject: IO ??????
It's not a secret anymore!