In this tutorial, we will discuss the use of getChar() method of ByteBuffer class to fetch the character.
In the given example, we will
see how to get characters from byte buffer.
The put() method of ByteBuffer class write bytes into buffer, and the getChar() method of
ByteBuffer class returns the character at current position and increment the position by two bytes.
About ByteBuffer API:
The java.nio.ByteBuffer class extends java.nio.Buffer class. It provides the following methods:
|abstract CharBuffer||asCharBuffer()||The asCharBuffer() method create a view of associated buffer as char buffer.|
|ByteBuffer||put()||The put() method write bytes into associated buffer.|
|abstract char||getChar()||The getChar(.) method returns character from byte buffer.|
Character available in buffer : Bharat Singh
Posted on: July 26, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles