java.io and java.nio

FileSystem

The FileSystem class is part of the java.nio.file package.It represents a file system, which provides access to file stores, file attributes, and files themselves. FileSystem acts as a factory for Path objects.It abstracts the underlying file system (e.g., Windows, Unix, ZIP file system).You don’t create FileSystem instances directly; instead, you obtain them via the FileSystems …

FileSystem Read More »

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 »

Scroll to Top