Input-Output

Input-Output

In Java, Input-Output (I/O) is a mechanism to communicate with the external world. It provides the ability to read from or write to different sources or destinations, such as files, sockets, pipes, and more.

The basic classes for I/O are defined in the java.io package. This package provides classes and interfaces for various types of I/O operations, such as reading and writing bytes, characters, and objects.

Java provides two types of streams for I/O: byte streams and character streams. Byte streams handle I/O of raw binary data, while character streams handle I/O of character data. There are several classes for both types of streams, including:

InputStream and OutputStream: The base classes for byte streams.

Reader and Writer: The base classes for character streams.

FileInputStream and FileOutputStream: Classes for reading and writing bytes to a file.

FileReader and FileWriter: Classes for reading and writing characters to a file.

ByteArrayInputStream and ByteArrayOutputStream: Classes for reading and writing bytes to an in-memory byte array.

CharArrayReader and CharArrayWriter: Classes for reading and writing characters to an in-memory character array.

BufferedInputStream and BufferedOutputStream: Classes for buffering byte streams.

BufferedReader and BufferedWriter: Classes for buffering character streams. In addition to these classes, Java provides several utility classes and interfaces for I/O, such as DataInputStream, DataOutputStream, ObjectInputStream, ObjectOutputStream, and more.

Apply for Core Java Developer Certification Now!!

https://www.vskills.in/certification/certified-core-java-developer

Back to Tutorial

Share this post
[social_warfare]
Throw and Throws
BufferedReader

Get industry recognized certification – Contact us

keyboard_arrow_up