tam1

Java-PrintWriter

PrintWriter The java.io.PrintWriter class is a subclass of java.io.Writer. PrintWriter is essentially a character-oriented version of PrintStream, that contains the familiar print( ) and println( ) methods from PrintStream. The PrintWriter class implements the abstract write() methods from java.io.Writer. The PrintWriter can send text either to an output stream or to another writer. Print and … Read more…

tam1

Java-PrintStream

PrintStream We can use print streams to output data into a file or to the console. System.out and System.err are instances of the PrintStream class. This is a subclass of FilterOutputStream that converts primitive types and objects to text. System.out is primarily used for simple, character-mode applications. All characters printed by a PrintStream are converted into bytes … Read more…

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…