Additional Java SE Packages

Selector

Selector is a part of Java NIO (New I/O) that allows a single thread to monitor multiple channels (SocketChannel, ServerSocketChannel) for events like read, write, or accept. It’s the backbone of scalable non-blocking I/O applications. Commonly Used Methods Simple Program: Selector with ServerSocketChannel LotusJavaPrince and Mahesh want to create a simple server that accepts client …

Selector Read More »

SocketChannel and ServerSocketChannel

In Java NIO (New I/O), SocketChannel and ServerSocketChannel are powerful classes used for non-blocking network communication. These classes are part of the java.nio.channels package and allow developers to build efficient client-server applications without relying on the traditional blocking I/O of java.net.Socket and java.net.ServerSocket. SocketChannel – The Client-Side Channel Definition SocketChannel is a channel-based version of …

SocketChannel and ServerSocketChannel Read More »

FileChannel

FileChannel is a class in java.nio.channels that provides a faster and more flexible way to read, write, map, and manipulate files. It works with ByteBuffer and allows for operations like random access, memory-mapped I/O, and file locking. Unlike InputStream/OutputStream, it supports non-blocking I/O and asynchronous operations. Opening a FileChannel Commonly Used Methods Simple Program: Writing …

FileChannel Read More »

Channel

In Java NIO (java.nio.channels), a Channel represents a bi-directional connection to a data source (like a file, socket, or device) that supports efficient reading and writing of data. Unlike streams, channels are bidirectional and often support non-blocking I/O, making them powerful for large-scale or high-performance I/O operations. Common Implementing Interfaces The Channel interface in Java …

Channel Read More »

DoubleBuffer

DoubleBuffer is a buffer class from java.nio that manages sequences of 64-bit double-precision floating-point numbers (double). It is used for fast, efficient, and flexible manipulation of double data in memory, suitable for high-performance scientific computations, graphics, or real-time analytics.DoubleBuffer is abstract. Use static allocate() and wrap()  factory methods to get instances. Commonly Used Methods Simple …

DoubleBuffer Read More »

FloatBuffer

FloatBuffer is a class in the java.nio package that represents a buffer of 32-bit floating-point numbers (floats). It is part of Java’s NIO (New Input/Output) API designed for efficient memory-based data manipulation—especially useful in graphics, gaming, scientific computing, and real-time processing.FloatBuffer is an abstract class. You create instances using these static allocate() and wrap() factory …

FloatBuffer Read More »

IntBuffer

IntBuffer is a class from the java.nio package in Java that allows you to work efficiently with sequences of 32-bit signed integers. It is part of the NIO (New I/O) library and supports buffer-based data manipulation useful for I/O operations, communication protocols, and performance-critical applications.IntBuffer is abstract; you create an instance using static factory methods …

IntBuffer Read More »

ShortBuffer

ShortBuffer is part of the java.nio package and provides a buffer for manipulating 16-bit short integers. It is useful in low-level I/O tasks, such as binary data processing, communication protocols, and memory-mapped files.ShortBuffer is an abstract class; instances are created using the allocate() or wrap() static methods. Commonly Used Methods Simple Program using ShortBuffer(Storing and …

ShortBuffer Read More »

CharBuffer

CharBuffer is part of the java.nio package and is a buffer for handling characters. It is useful for character-based input/output operations, such as text parsing, network communication, or file processing. It works similarly to ByteBuffer but specifically stores 16-bit char values. Commonly Used Methods Simple Program using CharBuffer Writing and Reading Characters Problem Statement: LotusJavaPrince …

CharBuffer Read More »

Scroll to Top