
- Input Stream: These streams carry the data from some source in to the program. The source may be a keyboard, a file …Here read operation is performed to input the data in to the program.
- Output Stream: They carry the data from program to some destination. The destination may be a monitor, printer, a file … Here write operation is performed to send data from the program.
- int read(): Reads next char from the stream as integer and returns -1 if no data is available in the stream.
- int read(char c[]): Reads an array full of characters from the stream and returns actual number of characters read.
- int read(char c[], int start, int end): Reads character in to array from the specified start and end position form the stream.
- long available(): Returns how many number of characters yet to be read in the stream.
- long skip(long n): Skips specified number of characters in the input stream and returns actual number of characters skipped
- void mark(int readLimit): Marks the current position and it is valid till specified read limit.
- boolean isMarkSupported(): Checks whether the Stream supports the mark facility or not
- void reset(): Moves to the recent marked position or beginning of the stream
- void close(): Closes the stream.
Stream
Class Name
|
Use
|
FileReader
|
used to read from files
|
PipedReader
|
used to read from pipes
|
CharArrayReader
|
used to read from a char
array
|
StringReader
|
used to read from a String
|
InputStreamReader
|
used to convert byte stream
to character stream
|
BufferedReader
|
provides buffer facility to
the Reader
|
PushBackReader
|
provides un reading facility
to the Reader
|
- void write(int c): Writes one character to output stream.
- void write(char c[]): Writes an array full of characters to output stream.
- void write(char c[], int start, int end): Writes characters from array to output stream from the specified start and end position.
- void flush(): Flushes the stream i.e., immediately releases the pending data from stream.
- void close(): Closes the output stream.
Stream Class Name
|
Use
|
FileWriter
|
used to write data into a file
|
PipedWriter
|
used to write data to a pipe
|
CharArrayWriter
|
used to write data to a byte array
|
StringWriter
|
used to write string to a Writer
|
PrintWriter
|
used to print any data on Writer
|
BufferedWriter
|
provides buffer facility to the Writer
|
OutputStreamWriter
|
used to convert character stream to byte stream
|
No comments:
Post a Comment