Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Java writer class 
 

Tutorial below is regarding Java writer class. Java writer class is an abstractly implemented idea for writing text files using character streams. It is defined inside java.io package.

 

Java writer class

                         

Tutorial below is regarding Java writer class. Java writer class is an abstractly implemented idea for writing text files using character streams. It is defined inside java.io package. This class is the root of all the classes that write character output streams. In short, writer class provides foundation for the classes that write character output streams. This java writer hierarchy contains many classes such as PrintWriter, BufferedWriter, FileWriter, OutputStreamWriter and many more.

Diagram below demonstrates a subset of the Writer hierarchy. Diagram demonstrates the classes that are used to create an OutputStream environment of  characters for writing text files.

 

 

Class PrintWriter defined inside the abstract class writer, writes or has function defined to put the data (characters)  into the character output stream. Similarly class BufferedWriter creates a temporary memory called buffer for the character output stream so that the stream values that are the actually the characters, can be processed more efficiently. Class FileWriter interconnects the character output stream to the path of a file.  Class OutputStream Writer creates interface (like a bridge as connector) from a character output stream to a binary stream.

Note: Al l data is stored as text characters with one character per byte on disk.

A Stream is the flow of data from one location to another and an output stream is the flow of data as characters from the internal memory of an application to a disk file. With writer classes data as text are written on text files.

Stream to get its functionality requires layering in which two or more streams are layered and forms a filtered stream. This filtered stream now possess all the functionality to perform either Input or Output operation.

While working with writer classes following three different types of exceptions are often generated.

IOException :- Is thrown when an error occurs during I/O processing.

EOFException :- Is thrown when the program control attempts to read beyond the end of the file.

FileNotFoundException :-  Is thrown when the program control attempts to open a file that does not exists .

All the above exceptions can be handled with try and catch blocks. Also can be avoided by using throws keyword.

Syntax for using throws keyword :- throws   Exception_name    
                           
For example :- throws IOException

                         

» View all related tutorials
Related Tags: c class classes output stream trac ai subclass write abstract example work contains exam sse bot e it bstr demo

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.