• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IO ??????

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :-(!!!
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :-(!!!


 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
anamika sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THANX!!! Rajdev
Anamika
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic