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)
System.in is of InputStream type.
System.in, 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.