Scatter Gather

Java-Scatter and Gather

Scatter and Gather Channels provide an important new capability known as scatter/gather. Scatter/gather is a simple yet powerful concept. It refers to performing a single I/O operation across multiple buffers. For a write operation, data is gathered (drained) from several buffers in turn and sent along the channel. The buffers do not need to have … Read more…

Java-Channels

Channels Channels are defined in java.nio.channels. Channels are analogous to streams in the original I/O package. A channel represents an open connection to an Input/Output device, such as a file or a socket. All data that goes anywhere (or comes from anywhere) must pass through a Channel object. In general, to use the NIO system, you obtain … Read more…

unsigned to signed

Java-Accessing Unsigned Data

Accessing Unsigned Data The Java programming language does not provide direct support for unsigned numeric values (other than char). But there are many instances in which you may need to extract unsigned information from a data stream or file, or pack data to create file headers or other structured information with unsigned fields. The ByteBuffer … Read more…

get

Java-Put and Get Multibyte Data

Put and Get Multibyte Data The ByteBuffer class provides a lightweight mechanism to access groups of bytes as a multibyte data type. ByteBuffer contains setter and getter methods for each of the primitive data types. Setter/Getter methods access the bytes of the ByteBuffer, starting at the current position, as if a data element of that … Read more…

Java-Byte Ordering

Byte Ordering All primitive types are composed of several bytes: a character or a short integer occupies 2 bytes, a 32-bit integer or a floating-point value occupies 4 bytes, and a long integer or a double precision floating-point value occupies 8 bytes. Each value of one of these multibyte types is stored in a sequence of contiguous memory locations. … Read more…

Java-ByteBuffer to Primitive Buffer

ByteBuffer to Primitive Buffer When doing high-volume Input/Output, odds are you’ll be using ByteBuffers to read in files, receive data from network connections, etc. Once the data has arrived in your ByteBuffer, you’ll need to look at it to decide what to do or manipulate it before sending it along. The ByteBuffer class provides a … Read more…