Additional Java SE Packages

Externalizable

Externalizable is an interface in Java (part of java.io) that gives the programmer complete control over the serialization process. Unlike Serializable, where Java handles serialization automatically, Externalizable requires the class to explicitly implement how the object’s state is written and read. Interface Definition Simple Program: Custom Serialization Using Externalizable LotusJavaPrince wants to store Mahesh’s login

Externalizable Read More »

OutputStreamWriter

OutputStreamWriter is a bridge from character streams to byte streams. It encodes character data into bytes using a specified charset and writes them to an underlying byte stream (like FileOutputStream,Socket.getOutputStream()). It is typically used when you need to write character data to a destination that only supports byte streams. Commonly Used Constructors and Methods Simple

OutputStreamWriter Read More »

InputStreamReader

InputStreamReader is a bridge from byte streams to character streams. It reads bytes from an underlying InputStream and decodes them into characters using a specified charset (encoding). This is essential for reading text data from byte-based input sources like files, network connections, or system input (keyboard). Commonly Used Constructors and Methods Simple Program: Reading Console

InputStreamReader Read More »

BufferedWriter

BufferedWriter is a wrapper class around another Writer class (like FileWriter) that buffers output characters to provide efficient writing of characters, arrays, and strings. It reduces the number of physical write operations by buffering data internally, improving performance, especially when writing large text files or multiple small writes. Commonly Used Constructors and Methods Simple Program:

BufferedWriter Read More »

Practice Programs on Byte Streams

1. Read Data Using ByteArrayInputStream This program demonstrates the use of ByteArrayInputStream to read data from a byte array. It reads each byte and converts it into characters for display. 2. Write Data Using ByteArrayOutputStream This program demonstrates the use of ByteArrayOutputStream to write data into a byte array. The stored data is displayed by

Practice Programs on Byte Streams Read More »

Scroll to Top