Java I/O How to - Java nio Buffer Example

  1. Java Compare Endian differences and data storage
  2. Java Create an Empty DoubleBuffer
  3. Java Create a LongBuffer
  4. Java Create a very large file using mapping
  5. Java Map FileChannel to an IntBuffer and read from the IntBuffer
  6. Java Put integers to a mapped IntBuffer
  7. Java Store and read a short
  8. Java Test the effects of buffer flipping


  1. Java Add Bytes into a ByteBuffer
  2. Java Convert ByteBuffer to an IntBuffer
  3. Java Convert ByteBuffer to a CharBuffer
  4. Java Convert ByteBuffer to a FloatBuffer
  5. Java Convert ByteBuffer to a LongBuffer
  6. Java Convert ByteBuffer to a ShortBuffer
  7. Java Convert ByteBuffer to CharBuffer
  8. Java Convert ByteBuffer to DoubleBuffer
  9. Java Convert text to and from ByteBuffers
  10. Java Convert text to and from ByteBuffers with UTF-16BE
  11. Java Create a non-direct/direct (memory-mapped) ByteBuffer with a 10 byte capacity
  12. Java Create ByteBuffer from byte array
  13. Java Create MappedByteBuffer from FileInputStream
  14. Java Get remaining byte count in a ByteBuffer
  15. Java Get the ByteBuffer's capacity
  16. Java Read file upside/down with RandomAccessFile and MappedByteBuffer
  17. Java Read Mixed Data from a File through ByteBuffer
  18. Java Retrieve all bytes in the buffer
  19. Java Retrieve bytes between the position and limit
  20. Java Rewind a ByteBuffer
  21. Java Save ByteBuffer to a file
  22. Java Set the limit for ByteBuffer
  23. Java Store and read an int/long/float/double via ByteBuffer
  24. Java Use while loop to read a ByteBuffer


  1. Java Compare two CharBuffer for Equality
  2. Java Duplicate CharBuffer
  3. Java Fill String to CharBuffer
  4. Java Get array out of CharBuffer
  5. Java Save and read text using FileChannel with CharBuffer
  6. Java Save char array to a CharBuffer
  7. Java Slice CharBuffer
  8. Java Store and read a char array
  9. Java Use while loop to read a CharBuffer


  1. Java Loop through a LongBuffer with a while loop
  2. Java Set the position
  3. Java Set the position to 0


  1. Java Use the absolute get()
  2. Java Use the relative get()