1 / 5

Stream Classes

Stream Classes. Object. InputStream. OutputStream. RandomAccess File. Reader. Writer. StreamTokenizer. FileInputStream. FileOutputStream. InputStreamReader. OutputStreamReader. FileReader. FileWriter. Streams of bytes. Streams of Characters. Java’s View of a File of n bytes. E O

yael
Download Presentation

Stream Classes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Stream Classes Object InputStream OutputStream RandomAccess File Reader Writer StreamTokenizer FileInputStream FileOutputStream InputStreamReader OutputStreamReader FileReader FileWriter Streams of bytes Streams of Characters

  2. Java’s View of a File of n bytes E O F n-1 0 2 ………………………………

  3. InputStream/Reader public abstract int read() throws IOException Reads the next byte and returns its value (betweeen 0 and 255); returns –1 at the end. public void close() throws IOException Closes the input stream public void int available () throws IOException Returns the number of bytes that can be read from the input (Works only in InputStream)

  4. OutputStream/Writer public abstract void write(int b) throws IOException Writes a byte (for OutputStream) or a character (for Writer) public void close () throws IOException Closes the output stream

  5. StreamTokenizer Constant Description TT_WORD The token is a word. TT_NUMBER The token is a number. TT_EOL The end of the line has been read. TT_EOF The end of the file has been read. Variable Description int ttype Current token type double nval value of current token, if number String sval String that contains the characters of current token.

More Related