Class BufferWrapper.AbstractBufferWrapper<T extends java.nio.Buffer>

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void doGetByte​(byte[] array, int offset, int length)  
      protected abstract void doGetDouble​(double[] array, int offset, int length)  
      protected abstract void doGetFloat​(float[] array, int offset, int length)  
      protected abstract void doGetInt​(int[] array, int offset, int length)  
      protected abstract void doGetShort​(short[] array, int offset, int length)  
      protected abstract BufferWrapper doGetSubBuffer()  
      protected abstract void doPutByte​(byte[] array, int offset, int length)  
      protected abstract void doPutDouble​(double[] array, int offset, int length)  
      protected abstract void doPutFloat​(float[] array, int offset, int length)  
      protected abstract void doPutInt​(int[] array, int offset, int length)  
      protected abstract void doPutShort​(short[] array, int offset, int length)  
      protected abstract boolean doPutSubBuffer​(int index, BufferWrapper buffer, int offset, int length)  
      java.nio.Buffer getBackingBuffer()
      Returns the buffer's backing data sture.
      void getByte​(int index, byte[] array, int offset, int length)
      Returns the sequence of values starting at the specified index and with the specified length, cast to bytes.
      void getDouble​(int index, double[] array, int offset, int length)
      Returns the sequence of values starting at the specified index and with the specified length, cast to doubles.
      void getFloat​(int index, float[] array, int offset, int length)
      Returns the sequence of values starting at the specified index and with the specified length, cast to floats.
      void getInt​(int index, int[] array, int offset, int length)
      Returns the sequence of values starting at the specified index and with the specified length, cast to ints.
      void getShort​(int index, short[] array, int offset, int length)
      Returns the sequence of values starting at the specified index and with the specified length, cast to shorts.
      BufferWrapper getSubBuffer​(int index, int length)
      Returns a new BufferWrapper which is a subsequence of this buffer.
      int length()
      Returns the length of the buffer, in units of the underlying data type (e.g.
      void putByte​(int index, byte[] array, int offset, int length)
      Sets the sequence of values starting at the specified index and with the specified length, as bytes.
      void putDouble​(int index, double[] array, int offset, int length)
      Sets the sequence of values starting at the specified index and with the specified length, as doubles.
      void putFloat​(int index, float[] array, int offset, int length)
      Sets the sequence of values starting at the specified index and with the specified length, as floats.
      void putInt​(int index, int[] array, int offset, int length)
      Sets the sequence of values starting at the specified index and with the specified length, as ints.
      void putShort​(int index, short[] array, int offset, int length)
      Sets the sequence of values starting at the specified index and with the specified length, as ints.
      void putSubBuffer​(int index, BufferWrapper buffer)
      Sets a subsequence of this buffer with the contents of the specified buffer.
      void putSubBuffer​(int index, BufferWrapper buffer, int offset, int length)
      Sets a subsequence of this buffer with the contents of the specified buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • buffer

        protected T extends java.nio.Buffer buffer
    • Constructor Detail

      • AbstractBufferWrapper

        public AbstractBufferWrapper​(T buffer)
    • Method Detail

      • length

        public int length()
        Description copied from class: BufferWrapper
        Returns the length of the buffer, in units of the underlying data type (e.g. bytes, shorts, ints, floats, doubles).
        Specified by:
        length in class BufferWrapper
        Returns:
        the buffer's length.
      • getByte

        public void getByte​(int index,
                            byte[] array,
                            int offset,
                            int length)
        Description copied from class: BufferWrapper
        Returns the sequence of values starting at the specified index and with the specified length, cast to bytes.
        Specified by:
        getByte in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to get.
      • putByte

        public void putByte​(int index,
                            byte[] array,
                            int offset,
                            int length)
        Description copied from class: BufferWrapper
        Sets the sequence of values starting at the specified index and with the specified length, as bytes. The bytes are cast to the underlying data type.
        Specified by:
        putByte in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to put.
      • getShort

        public void getShort​(int index,
                             short[] array,
                             int offset,
                             int length)
        Description copied from class: BufferWrapper
        Returns the sequence of values starting at the specified index and with the specified length, cast to shorts.
        Specified by:
        getShort in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to get.
      • putShort

        public void putShort​(int index,
                             short[] array,
                             int offset,
                             int length)
        Description copied from class: BufferWrapper
        Sets the sequence of values starting at the specified index and with the specified length, as ints. The ints are cast to the underlying data type.
        Specified by:
        putShort in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to put.
      • getInt

        public void getInt​(int index,
                           int[] array,
                           int offset,
                           int length)
        Description copied from class: BufferWrapper
        Returns the sequence of values starting at the specified index and with the specified length, cast to ints.
        Specified by:
        getInt in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to get.
      • putInt

        public void putInt​(int index,
                           int[] array,
                           int offset,
                           int length)
        Description copied from class: BufferWrapper
        Sets the sequence of values starting at the specified index and with the specified length, as ints. The ints are cast to the underlying data type.
        Specified by:
        putInt in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to put.
      • getFloat

        public void getFloat​(int index,
                             float[] array,
                             int offset,
                             int length)
        Description copied from class: BufferWrapper
        Returns the sequence of values starting at the specified index and with the specified length, cast to floats.
        Specified by:
        getFloat in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to get.
      • putFloat

        public void putFloat​(int index,
                             float[] array,
                             int offset,
                             int length)
        Description copied from class: BufferWrapper
        Sets the sequence of values starting at the specified index and with the specified length, as floats. The floats are cast to the underlying data type.
        Specified by:
        putFloat in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to put.
      • getDouble

        public void getDouble​(int index,
                              double[] array,
                              int offset,
                              int length)
        Description copied from class: BufferWrapper
        Returns the sequence of values starting at the specified index and with the specified length, cast to doubles.
        Specified by:
        getDouble in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to get.
      • putDouble

        public void putDouble​(int index,
                              double[] array,
                              int offset,
                              int length)
        Description copied from class: BufferWrapper
        Sets the sequence of values starting at the specified index and with the specified length, as doubles. The doubles are cast to the underlying data type.
        Specified by:
        putDouble in class BufferWrapper
        Parameters:
        index - the buffer starting index.
        array - the array.
        offset - the array starting index.
        length - the number of values to put.
      • getSubBuffer

        public BufferWrapper getSubBuffer​(int index,
                                          int length)
        Description copied from class: BufferWrapper
        Returns a new BufferWrapper which is a subsequence of this buffer. The new buffer starts with the value at the specified index, and has the specified length. The two buffers share the same backing store, so changes to this buffer are reflected in the new buffer, and vice versa.
        Specified by:
        getSubBuffer in class BufferWrapper
        Parameters:
        index - the new buffer's starting index.
        length - the new buffer's length.
        Returns:
        a subsequence of this buffer.
      • putSubBuffer

        public void putSubBuffer​(int index,
                                 BufferWrapper buffer)
        Description copied from class: BufferWrapper
        Sets a subsequence of this buffer with the contents of the specified buffer. The subsequence to set starts with the value at the specified index, and has length equal to the specified buffer's length.
        Specified by:
        putSubBuffer in class BufferWrapper
        Parameters:
        index - the starting index to set.
        buffer - the buffer.
      • putSubBuffer

        public void putSubBuffer​(int index,
                                 BufferWrapper buffer,
                                 int offset,
                                 int length)
        Description copied from class: BufferWrapper
        Sets a subsequence of this buffer with the contents of the specified buffer. The subsequence to set starts with the value at the specified index, and has length equal to the specified length.
        Specified by:
        putSubBuffer in class BufferWrapper
        Parameters:
        index - the starting index to set.
        buffer - the buffer.
        offset - the starting index to get from the buffer.
        length - the number of values to get from the buffer.
      • getBackingBuffer

        public java.nio.Buffer getBackingBuffer()
        Description copied from class: BufferWrapper
        Returns the buffer's backing data sture. For the standard BufferWrapper types (ByteBufferWrapper, ShortBufferWrapper, IntBufferWrapper, FloatBufferWrapper, and DoubleBufferWrapper), this returns the backing Buffer.
        Specified by:
        getBackingBuffer in class BufferWrapper
        Returns:
        the backing data store.
      • doGetByte

        protected abstract void doGetByte​(byte[] array,
                                          int offset,
                                          int length)
      • doPutByte

        protected abstract void doPutByte​(byte[] array,
                                          int offset,
                                          int length)
      • doGetShort

        protected abstract void doGetShort​(short[] array,
                                           int offset,
                                           int length)
      • doPutShort

        protected abstract void doPutShort​(short[] array,
                                           int offset,
                                           int length)
      • doGetInt

        protected abstract void doGetInt​(int[] array,
                                         int offset,
                                         int length)
      • doPutInt

        protected abstract void doPutInt​(int[] array,
                                         int offset,
                                         int length)
      • doGetFloat

        protected abstract void doGetFloat​(float[] array,
                                           int offset,
                                           int length)
      • doPutFloat

        protected abstract void doPutFloat​(float[] array,
                                           int offset,
                                           int length)
      • doGetDouble

        protected abstract void doGetDouble​(double[] array,
                                            int offset,
                                            int length)
      • doPutDouble

        protected abstract void doPutDouble​(double[] array,
                                            int offset,
                                            int length)
      • doGetSubBuffer

        protected abstract BufferWrapper doGetSubBuffer()
      • doPutSubBuffer

        protected abstract boolean doPutSubBuffer​(int index,
                                                  BufferWrapper buffer,
                                                  int offset,
                                                  int length)