Share on Google+Share on Google+

Java Bytebuffer

Advertisement
ByteBuffer is one of the sub class of abstract class Buffer in the "nio" package.

Java Bytebuffer

     

ByteBuffer is one of the sub class of abstract class Buffer in the "nio" package. 

Buffer class has subclasses for each non-boolean primitive type:

  1. ByteBuffer
  2. CharBuffer
  3. DoubleBuffer
  4. FloatBuffer
  5. IntBuffer
  6. LongBuffer
  7. ShortBuffer

If we compare these subclasses of Buffer, we will find them very similar. 

The ByteBuffer class provides two more capabilities that makes it more general than other subclasses of Buffer. 

These are methods absolute and relative get() and put() methods and methods for creating view buffers. This class is also important for the use of channels in java.

-- Absolute and relative get() is used to read and put() methods is used to write values of primitive types other than byte.
--  There are also methods needed to create the view buffers. This allows the byte buffer to be viewed as a general buffer that contains primitive type values other than Bytes.

 

Advertisements

Advertisement

Posted on: October 6, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Comments:0