Additional Java SE Packages

PipedInputStream

PipedInputStream is used to read data written to a connected PipedOutputStream. It provides a communication pipe between two threads, enabling one thread to write data and another to read it.This class is part of Java’s inter-thread communication system and works in conjunction with PipedOutputStream. Commonly Used Constructors and Methods Simple Program – Inter-thread Communication Mahesh […]

PipedInputStream Read More »

ObjectOutputStream

ObjectOutputStream is used to serialize Java objects—convert them into a byte stream so they can be written to files or sent over a network. It’s the counterpart of ObjectInputStream, which performs deserialization. Commonly Used Constructors and Methods The object being written must implement Serializable interface, or NotSerializableException is thrown. Simple Program – Serializing a Single

ObjectOutputStream Read More »

DataOutputStream

DataOutputStream lets you write Java primitive data types (like int, float, double, char, boolean) to an output stream in a machine-independent way. It’s usually paired with an OutputStream like FileOutputStream or ByteArrayOutputStream. Commonly Used Constructors and Methods Simple Program – Writing Primitives to File Mahesh wants to store LotusJavaPrince‘s employee ID, name, and salary in

DataOutputStream Read More »

DataInputStream

DataInputStream allows an application to read Java primitive data types (like int, float, char, etc.) from an underlying input stream in a machine-independent way. It’s commonly used with FileInputStream, ByteArrayInputStream, or any stream that provides raw bytes. Commonly Used Constructors and Methods Simple Program – Reading Primitives from File LotusJavaPrince stores his profile info using

DataInputStream Read More »

ByteArrayOutputStream

ByteArrayOutputStream is a memory-based stream that collects output data in an internal byte array. It’s useful when you want to build a byte array dynamically (e.g., generating PDF content, processing images, etc.).It automatically resizes its internal buffer as data is written. Commonly Used Constructors and Methods Simple Program – Writing and Printing Byte Array LotusJavaPrince

ByteArrayOutputStream Read More »

ByteArrayInputStream

ByteArrayInputStream allows an application to read data from a byte array as if it were an input stream. It is especially useful for simulating input for testing or for reading memory-stored data byte-by-byte. Commonly Used Constructors and Methods Simple Program – Reading from ByteArrayInputStream LotusJavaPrince wants to read a byte array “Hello, Mahesh” using ByteArrayInputStream

ByteArrayInputStream Read More »

Scroll to Top