Class SegmentedMemBuffer


  • public class SegmentedMemBuffer
    extends java.lang.Object
    A segmented, expanding buffer of bytes. This class does not copy the underlying bytes when the file grows. Hence, the performance is more predictable. (Resizing a fixed size buffer is a copy c.f. performance issues with ArrayList or ByteArrayOutputStream as they go from small to large.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean isOpen()  
      long length()  
      void open()  
      int read​(long posn, byte[] b)  
      int read​(long posn, byte[] b, int start, int length)  
      int read​(long posn, java.nio.ByteBuffer bb)  
      void sync()  
      void truncate​(long length)  
      void write​(long posn, byte[] b)  
      void write​(long posn, byte[] b, int start, int length)  
      void write​(long posn, java.nio.ByteBuffer bb)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SegmentedMemBuffer

        public SegmentedMemBuffer()
      • SegmentedMemBuffer

        public SegmentedMemBuffer​(int chunk)
    • Method Detail

      • open

        public void open()
      • isOpen

        public boolean isOpen()
      • read

        public int read​(long posn,
                        java.nio.ByteBuffer bb)
      • read

        public int read​(long posn,
                        byte[] b)
      • read

        public int read​(long posn,
                        byte[] b,
                        int start,
                        int length)
      • write

        public void write​(long posn,
                          java.nio.ByteBuffer bb)
      • write

        public void write​(long posn,
                          byte[] b)
      • write

        public void write​(long posn,
                          byte[] b,
                          int start,
                          int length)
      • truncate

        public void truncate​(long length)
      • sync

        public void sync()
      • close

        public void close()
      • length

        public long length()