0% found this document useful (0 votes)
5 views4 pages

Java FileInputStream and BufferedReader Methods

The document outlines the methods available in the Java FileInputStream, FileOutputStream, and BufferedReader classes for reading and writing data to files. It details specific methods such as available(), close(), read(), write(), and others, along with their descriptions and return types. Additionally, it references related tutorials for further learning on Java I/O streams.

Uploaded by

G. Netpryse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Java FileInputStream and BufferedReader Methods

The document outlines the methods available in the Java FileInputStream, FileOutputStream, and BufferedReader classes for reading and writing data to files. It details specific methods such as available(), close(), read(), write(), and others, along with their descriptions and return types. Additionally, it references related tutorials for further learning on Java I/O streams.

Uploaded by

G. Netpryse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Java FileInputStream

Methods
FileInputStream Methods
The FileInputStream class provides methods to read data (as bytes) from a
file:

Method Description Return Type

available() Returns the number of bytes that can be int


read without blocking

close() Closes the stream and releases system void


resources

read() Reads one byte of data int

read() Reads bytes into an array (or part of an int


array)

skip() Skips over and discards n bytes of data long

getFD() Returns the file descriptor object FileDescriptor


associated with the stream

getChannel() Returns the unique FileChannel object FileChannel


for this stream

Related Pages
Java I/O Streams Tutorial

Java FileInputStream Tutorial


COLOR PICKER

REMOVE ADS

Java FileOutputStream
Methods
FileOutputStream Methods
The FileOutputStream class provides methods to write data (as bytes) to a
file:

Method Description Return Type

close() Closes the stream and releases system void


resources

flush() Flushes the stream - forces any buffered void


output bytes to be written immediately
write() Writes one byte, an array of bytes, or void
part of an array to the file

getFD() Returns the file descriptor object FileDescriptor


associated with the stream

getChannel() Returns the unique FileChannel object FileChannel


for this stream

Related Pages

Java BufferedReader
Methods
BufferedReader Methods
The BufferedReader class provides methods to read text efficiently:

Method Description Return Type

close() Closes the stream and releases system void


resources

mark() Marks the current position in the stream void

markSupporte Checks if mark() and reset() are boolean


d() supported

read() Reads a single character int

read() Reads characters into an array or a int


portion of an array

readLine() Reads one full line of text String

ready() Checks if the stream is ready to be read boolean

reset() Resets the stream to the last marked void


position

skip() Skips over characters in the stream long

lines() Returns a Stream<String> of all lines Stream<Strin


g>

transferTo() Reads all characters and writes them to long


the given writer
Related Pages
Java I/O Streams Tutorial

Java BufferedReader Tutorial

COLOR PICKER

REMOVE ADS

You might also like