InputStream is an abstract class that defines Java's mocu of streaming byte input. All of the methods in this class will throw an IOException on error conditions.Shows the methods in InputStream.

Method                                                                        Description

int available( )                                                                 Returns the number of bytes of input currently available for reading.

void closet( )                                                                    Closes the input source. Purther read attempts will generate an 10exception.

void mark(int num Bytes)                                            Places a mark at the current point in the input stream that will remain valid until                                                                                                           numBytes bytes arc read.

boolean markSupported( )                                           Returns true if markt()/reset() arc supported by the invoking stream.

int read()                                                                            Returns an integer representation of the next available byte of input -1 is returned when                                                                                                the end of the file is encountered.

int read (byte buffer )                                                     Attempts to read up to buffer.length bytes into buffer and returns the actual number of                                                                                                  bytes that were successfully read. -1 is returned  when the end of the file is encountered.

int read (byte buffer  int offset,
int numBytes)                                                                    Attempts to read up to numBytes bytes into buffer starting at buffer[offset], returning                                                                                                     the number of bytes successfully read. -1 is returned when the end of the file is


OutputStream is an abstract class that defines streaming byte output. All of the methods in this class return a void value and throw an IOException in the case of errors. Shows the methods in outputStream.

 Most of tile methods described ill  are implemented  the subclasses of inputStream ann Oltp Strcnm. The nutrkt () and reset () methods arc exceptions; notice their  or lack there by melt subclass in the discussions that follow.

Share This