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…

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. [accordion] [toggle title=”Setter Methods” state=”closed”] Method Description ByteBuffer putChar (char value) Writes two bytes containing the given char value, in … 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…