Interface BigByteBuffer


public sealed interface BigByteBuffer
This class has an API similar to ByteBuffer, but is addressable with long indices. Implementations are backed by one or more ByteBuffers.

Differences from ByteBuffer include:

  • mark and reset are not supported
  • read-only is not supported
  • byte order is preserved in duplicate() and slice().
biteytech@protonmail.com, adapted from ByteBuffer
  • Method Details

    • buffers

      ByteBuffer[] buffers()
      Returns the underlying buffers.
      Returns:
      the underlying buffers.
    • position

      long position()
      Returns this buffer's position.
      Returns:
      The position of this buffer
    • limit

      long limit()
      Returns this buffer's limit.
      Returns:
      The limit of this buffer
    • capacity

      long capacity()
      Returns this buffer's capacity.
      Returns:
      The capacity of this buffer
    • position

      BigByteBuffer position(long newPosition)
      Sets this buffer's position.
      Parameters:
      newPosition - The new position value; must be non-negative and no larger than the current limit
      Returns:
      this buffer
      Throws:
      IllegalArgumentException - If the preconditions on newPosition do not hold
    • limit

      BigByteBuffer limit(long newLimit)
      Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit.
      Parameters:
      newLimit - The new limit value; must be non-negative and no larger than this buffer's capacity
      Returns:
      this buffer
      Throws:
      IllegalArgumentException - If the preconditions on newLimit do not hold
    • remaining

      long remaining()
      Returns the number of bytes between the current position and the limit.
      Returns:
      The number of bytes remaining in this buffer
    • hasRemaining

      boolean hasRemaining()
      Tells whether there are any bytes between the current position and the limit.
      Returns:
      true if, and only if, there is at least one byte remaining in this buffer
    • order

      ByteOrder order()
      Retrieves this buffer's byte order.

      The byte order is used when reading or writing multibyte values, and when creating buffers that are views of this byte buffer. The order of a newly-created byte buffer is always BIG_ENDIAN.

      Returns:
      This buffer's byte order
    • order

      BigByteBuffer order(ByteOrder order)
      Modifies this buffer's byte order.
      Parameters:
      order - The new byte order, either BIG_ENDIAN or LITTLE_ENDIAN
      Returns:
      this buffer
    • duplicate

      BigByteBuffer duplicate()
      Creates a new byte buffer that shares this buffer's content.

      The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's capacity, limit, position, and byte order values will be identical to those of this buffer. The new buffer will be direct if, and only if, this buffer is direct.

      Returns:
      The new byte buffer
    • slice

      BigByteBuffer slice()
      Creates a new byte buffer whose content is a shared subsequence of this buffer's content.

      The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer, and the byte order will be the same as this buffer. The new buffer will be direct if, and only if, this buffer is direct.

      Returns:
      The new byte buffer
    • slice

      BigByteBuffer slice(long fromIndex, long toIndex)
      Creates a new byte buffer whose content is a shared subsequence of this buffer's content.
      Returns:
      The new byte buffer
    • smallSlice

      ByteBuffer smallSlice()
      Creates a new ByteBuffer whose content is a shared subsequence of this buffer's content.

      The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer, and the byte order will be the same as this buffer. The new buffer will be direct if, and only if, this buffer is direct.

      Returns:
      The new byte buffer
    • smallSlice

      ByteBuffer smallSlice(long fromIndex, long toIndex)
      Creates a new ByteBuffer whose content is a shared subsequence of this buffer's content.
      Returns:
      The new byte buffer
    • copy

      BigByteBuffer copy(long fromIndex, long toIndex)
      Returns a copy of a range from this buffer.
      Returns:
      a copy of a range from this buffer.
    • clear

      BigByteBuffer clear()
      Clears this buffer. The position is set to zero and the limit is set to the capacity.

      This method does not actually erase the data in the buffer, but it is named as if it did because it will most often be used in situations in which that might as well be the case.

      Returns:
      This buffer
    • flip

      Flips this buffer. The limit is set to the current position and then the position is set to zero.
      Returns:
      This buffer
    • put

      BigByteBuffer put(byte value)
      Relative put method.

      Writes the given byte into this buffer at the current position, and then increments the position.

      Parameters:
      value - The byte to be written
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If this buffer's current position is not smaller than its limit
    • put

      BigByteBuffer put(long index, byte value)
      Absolute put method.

      Writes the given byte into this buffer at the given index.

      Parameters:
      index - The index at which the byte will be written
      value - The byte value to be written
      Returns:
      This buffer
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit
    • put

      Relative bulk put method

      This method transfers the bytes remaining in the given source buffer into this buffer. If there are more bytes remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no bytes are transferred and a BufferOverflowException is thrown.

      Otherwise, this method copies n = src.remaining() bytes from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

      In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

       while (src.hasRemaining())
              dst.put(src.get());
       
      except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.
      Parameters:
      src - The source buffer from which bytes are to be read; must not be this buffer
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer for the remaining bytes in the source buffer
      IllegalArgumentException - If the source buffer is this buffer
    • put

      Relative bulk put method

      This method transfers the bytes remaining in the given source buffer into this buffer. If there are more bytes remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no shorts are transferred and a BufferOverflowException is thrown.

      Otherwise, this method copies n = src.remaining() doubles from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

      In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

       while (src.hasRemaining())
              dst.put(src.get());
       
      except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.
      Parameters:
      src - The source buffer from which bytes are to be read; must not be this buffer
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer for the remaining bytes in the source buffer
    • put

      BigByteBuffer put(byte[] src)
      Relative bulk put method

      This method transfers the entire content of the given source byte array into this buffer.

      Parameters:
      src - The source array
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer
    • put

      BigByteBuffer put(long index, ByteBuffer src, int offset, int length)
      Absolute bulk put method.

      This method transfers length bytes into this buffer from the given source buffer, starting at the given offset in the source buffer and the given index in this buffer. The positions of both buffers are unchanged.

      In other words, an invocation of this method of the form dst.put(index, src, offset, length) has exactly the same effect as the loop

      
       for (int i = offset, j = index; i < offset + length; i++, j++)
       	dst.put(j, src.get(i));
       
      except that it first checks the consistency of the supplied parameters and it is potentially much more efficient. If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.
      Parameters:
      index - The index in this buffer at which the first byte will be written; must be non-negative and less than limit()
      src - The buffer from which bytes are to be read
      offset - The index within the source buffer of the first byte to be read; must be non-negative and less than src.limit()
      length - The number of bytes to be read from the given buffer; must be non-negative and no larger than the smaller of limit() - index and src.limit() - offset
      Returns:
      This buffer
      Throws:
      IndexOutOfBoundsException - If the preconditions on the index, offset, and length parameters do not hold
    • get

      byte get()
      Relative get method. Reads the byte at this buffer's current position, and then increments the position.
      Returns:
      The byte at the buffer's current position
      Throws:
      BufferUnderflowException - If the buffer's current position is not smaller than its limit
    • get

      byte get(long index)
      Absolute get method. Reads the byte at the given index.
      Parameters:
      index - The index from which the byte will be read
      Returns:
      The byte at the given index
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit
    • get

      BigByteBuffer get(byte[] dst, int offset, int length)
      Relative bulk get method.

      This method transfers bytes from this buffer into the given destination array. If there are fewer bytes remaining in the buffer than are required to satisfy the request, that is, if length > remaining(), then no bytes are transferred and a BufferUnderflowException is thrown.

      Otherwise, this method copies length bytes from this buffer into the given array, starting at the current position of this buffer and at the given offset in the array. The position of this buffer is then incremented by length.

      In other words, an invocation of this method of the form src.get(dst, off, len) has exactly the same effect as the loop

      
       for (int i = off; i < off + len; i++)
       	dst[i] = src.get();
       
      except that it first checks that there are sufficient bytes in this buffer and it is potentially much more efficient.
      Parameters:
      dst - The array into which bytes are to be written
      offset - The offset within the array of the first byte to be written; must be non-negative and no larger than dst.length
      length - The maximum number of bytes to be written to the given array; must be non-negative and no larger than dst.length - offset
      Returns:
      This buffer
      Throws:
      BufferUnderflowException - If there are fewer than length bytes remaining in this buffer
      IndexOutOfBoundsException - If the preconditions on the offset and length parameters do not hold
    • get

      default BigByteBuffer get(byte[] dst)
      Relative bulk get method.

      This method transfers bytes from this buffer into the given destination array. An invocation of this method of the form src.get(a) behaves in exactly the same way as the invocation

       src.get(a, 0, a.length)
       
      Parameters:
      dst - The destination array
      Returns:
      This buffer
      Throws:
      BufferUnderflowException - If there are fewer than length bytes remaining in this buffer
    • asByteBuffer

      default SmallByteBuffer asByteBuffer()
      Creates a view of this byte buffer as a byte buffer.

      The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer, and its byte order will be that of the byte buffer at the moment the view is created.

      Returns:
      A new byte buffer
    • toInputStream

      InputStream toInputStream()
      Creates a new InputStream which streams this buffer's content.

      The stream will start at this buffer's current position, and end at this buffer's limit.

      Returns:
      the new InputStream
    • putShort

      BigByteBuffer putShort(short value)
      Relative put method for writing a short.

      Writes two bytes containing the given short value, in the current byte order, into this buffer at the current position, and then increments the position by two.

      Parameters:
      value - The short value to be written
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there are fewer than two bytes remaining in this buffer
    • putShort

      BigByteBuffer putShort(long index, short value)
      Absolute put method for writing a short.

      Writes two bytes containing the given short value, in the current byte order, into this buffer at the given index.

      Parameters:
      index - The index at which the bytes will be written
      value - The short value to be written
      Returns:
      This buffer
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • putShort

      BigByteBuffer putShort(short[] src)
      Relative bulk put method

      This method transfers the entire content of the given source short array into this buffer.

      Parameters:
      src - The source array
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer
    • putShort

      BigByteBuffer putShort(ShortBuffer src)
      Relative bulk put method

      This method transfers the shorts remaining in the given source buffer into this buffer. If there are more shorts remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no shorts are transferred and a BufferOverflowException is thrown.

      Otherwise, this method copies n = src.remaining() shorts from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

      In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

       while (src.hasRemaining())
              dst.put(src.get());
       
      except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.
      Parameters:
      src - The source buffer from which shorts are to be read; must not be this buffer
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer for the remaining shorts in the source buffer
    • getShort

      short getShort()
      Relative get method for reading a short value.

      Reads the next two bytes at this buffer's current position, composing them into a short value according to the current byte order, and then increments the position by two.

      Returns:
      The short value at the buffer's current position
      Throws:
      BufferUnderflowException - If there are fewer than two bytes remaining in this buffer
    • getShort

      short getShort(long index)
      Absolute get method for reading a short value.

      Reads two bytes at the given index, composing them into a short value according to the current byte order.

      Parameters:
      index - The index from which the bytes will be read
      Returns:
      The short value at the given index
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • asShortBuffer

      default SmallShortBuffer asShortBuffer()
      Creates a view of this byte buffer as a short buffer.

      The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by two, and its byte order will be that of the byte buffer at the moment the view is created.

      Returns:
      A new short buffer
    • putInt

      BigByteBuffer putInt(int value)
      Relative put method for writing a int.

      Writes four bytes containing the given int value, in the current byte order, into this buffer at the current position, and then increments the position by four.

      Parameters:
      value - The int value to be written
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there are fewer than four bytes remaining in this buffer
    • putInt

      BigByteBuffer putInt(long index, int value)
      Absolute put method for writing a int.

      Writes four bytes containing the given int value, in the current byte order, into this buffer at the given index.

      Parameters:
      index - The index at which the bytes will be written
      value - The int value to be written
      Returns:
      This buffer
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • putInt

      BigByteBuffer putInt(int[] src)
      Relative bulk put method

      This method transfers the entire content of the given source int array into this buffer.

      Parameters:
      src - The source array
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer
    • putInt

      BigByteBuffer putInt(IntBuffer src)
      Relative bulk put method

      This method transfers the ints remaining in the given source buffer into this buffer. If there are more ints remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no shorts are transferred and a BufferOverflowException is thrown.

      Otherwise, this method copies n = src.remaining() ints from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

      In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

       while (src.hasRemaining())
              dst.put(src.get());
       
      except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.
      Parameters:
      src - The source buffer from which ints are to be read; must not be this buffer
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer for the remaining ints in the source buffer
    • getInt

      int getInt()
      Relative get method for reading a int value.

      Reads the next four bytes at this buffer's current position, composing them into a int value according to the current byte order, and then increments the position by four.

      Returns:
      The int value at the buffer's current position
      Throws:
      BufferUnderflowException - If there are fewer than four bytes remaining in this buffer
    • getInt

      int getInt(long index)
      Absolute get method for reading a int value.

      Reads four bytes at the given index, composing them into a int value according to the current byte order.

      Parameters:
      index - The index from which the bytes will be read
      Returns:
      The int value at the given index
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • asIntBuffer

      default SmallIntBuffer asIntBuffer()
      Creates a view of this byte buffer as a int buffer.

      The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by four, and its byte order will be that of the byte buffer at the moment the view is created.

      Returns:
      A new int buffer
    • putLong

      BigByteBuffer putLong(long value)
      Relative put method for writing a long.

      Writes eight bytes containing the given long value, in the current byte order, into this buffer at the current position, and then increments the position by eight.

      Parameters:
      value - The long value to be written
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there are fewer than eight bytes remaining in this buffer
    • putLong

      BigByteBuffer putLong(long index, long value)
      Absolute put method for writing a long.

      Writes eight bytes containing the given long value, in the current byte order, into this buffer at the given index.

      Parameters:
      index - The index at which the bytes will be written
      value - The long value to be written
      Returns:
      This buffer
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • putLong

      BigByteBuffer putLong(long[] src)
      Relative bulk put method

      This method transfers the entire content of the given source long array into this buffer.

      Parameters:
      src - The source array
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer
    • putLong

      BigByteBuffer putLong(LongBuffer src)
      Relative bulk put method

      This method transfers the longs remaining in the given source buffer into this buffer. If there are more longs remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no shorts are transferred and a BufferOverflowException is thrown.

      Otherwise, this method copies n = src.remaining() longs from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

      In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

       while (src.hasRemaining())
              dst.put(src.get());
       
      except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.
      Parameters:
      src - The source buffer from which longs are to be read; must not be this buffer
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer for the remaining longs in the source buffer
    • getLong

      long getLong()
      Relative get method for reading a long value.

      Reads the next eight bytes at this buffer's current position, composing them into a long value according to the current byte order, and then increments the position by eight.

      Returns:
      The long value at the buffer's current position
      Throws:
      BufferUnderflowException - If there are fewer than eight bytes remaining in this buffer
    • getLong

      long getLong(long index)
      Absolute get method for reading a long value.

      Reads eight bytes at the given index, composing them into a long value according to the current byte order.

      Parameters:
      index - The index from which the bytes will be read
      Returns:
      The long value at the given index
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • asLongBuffer

      default SmallLongBuffer asLongBuffer()
      Creates a view of this byte buffer as a long buffer.

      The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by eight, and its byte order will be that of the byte buffer at the moment the view is created.

      Returns:
      A new long buffer
    • putFloat

      BigByteBuffer putFloat(float value)
      Relative put method for writing a float.

      Writes four bytes containing the given float value, in the current byte order, into this buffer at the current position, and then increments the position by four.

      Parameters:
      value - The float value to be written
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there are fewer than four bytes remaining in this buffer
    • putFloat

      BigByteBuffer putFloat(long index, float value)
      Absolute put method for writing a float.

      Writes four bytes containing the given float value, in the current byte order, into this buffer at the given index.

      Parameters:
      index - The index at which the bytes will be written
      value - The float value to be written
      Returns:
      This buffer
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • putFloat

      BigByteBuffer putFloat(float[] src)
      Relative bulk put method

      This method transfers the entire content of the given source float array into this buffer.

      Parameters:
      src - The source array
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer
    • putFloat

      BigByteBuffer putFloat(FloatBuffer src)
      Relative bulk put method

      This method transfers the floats remaining in the given source buffer into this buffer. If there are more floats remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no shorts are transferred and a BufferOverflowException is thrown.

      Otherwise, this method copies n = src.remaining() floats from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

      In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

       while (src.hasRemaining())
              dst.put(src.get());
       
      except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.
      Parameters:
      src - The source buffer from which floats are to be read; must not be this buffer
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer for the remaining floats in the source buffer
    • getFloat

      float getFloat()
      Relative get method for reading a float value.

      Reads the next four bytes at this buffer's current position, composing them into a float value according to the current byte order, and then increments the position by four.

      Returns:
      The float value at the buffer's current position
      Throws:
      BufferUnderflowException - If there are fewer than four bytes remaining in this buffer
    • getFloat

      float getFloat(long index)
      Absolute get method for reading a float value.

      Reads four bytes at the given index, composing them into a float value according to the current byte order.

      Parameters:
      index - The index from which the bytes will be read
      Returns:
      The float value at the given index
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • asFloatBuffer

      default SmallFloatBuffer asFloatBuffer()
      Creates a view of this byte buffer as a float buffer.

      The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by four, and its byte order will be that of the byte buffer at the moment the view is created.

      Returns:
      A new float buffer
    • putDouble

      BigByteBuffer putDouble(double value)
      Relative put method for writing a double.

      Writes eight bytes containing the given double value, in the current byte order, into this buffer at the current position, and then increments the position by eight.

      Parameters:
      value - The double value to be written
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there are fewer than eight bytes remaining in this buffer
    • putDouble

      BigByteBuffer putDouble(long index, double value)
      Absolute put method for writing a double.

      Writes eight bytes containing the given double value, in the current byte order, into this buffer at the given index.

      Parameters:
      index - The index at which the bytes will be written
      value - The double value to be written
      Returns:
      This buffer
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • putDouble

      BigByteBuffer putDouble(double[] src)
      Relative bulk put method

      This method transfers the entire content of the given source double array into this buffer.

      Parameters:
      src - The source array
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer
    • putDouble

      BigByteBuffer putDouble(DoubleBuffer src)
      Relative bulk put method

      This method transfers the doubles remaining in the given source buffer into this buffer. If there are more doubles remaining in the source buffer than in this buffer, that is, if src.remaining() > remaining(), then no shorts are transferred and a BufferOverflowException is thrown.

      Otherwise, this method copies n = src.remaining() doubles from the given buffer into this buffer, starting at each buffer's current position. The positions of both buffers are then incremented by n.

      In other words, an invocation of this method of the form dst.put(src) has exactly the same effect as the loop

       while (src.hasRemaining())
              dst.put(src.get());
       
      except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient. If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.
      Parameters:
      src - The source buffer from which doubles are to be read; must not be this buffer
      Returns:
      This buffer
      Throws:
      BufferOverflowException - If there is insufficient space in this buffer for the remaining doubles in the source buffer
    • getDouble

      double getDouble()
      Relative get method for reading a double value.

      Reads the next eight bytes at this buffer's current position, composing them into a double value according to the current byte order, and then increments the position by eight.

      Returns:
      The double value at the buffer's current position
      Throws:
      BufferUnderflowException - If there are fewer than eight bytes remaining in this buffer
    • getDouble

      double getDouble(long index)
      Absolute get method for reading a double value.

      Reads eight bytes at the given index, composing them into a double value according to the current byte order.

      Parameters:
      index - The index from which the bytes will be read
      Returns:
      The double value at the given index
      Throws:
      IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit, minus one
    • asDoubleBuffer

      default SmallDoubleBuffer asDoubleBuffer()
      Creates a view of this byte buffer as a double buffer.

      The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position and limit values will be independent.

      The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by eight, and its byte order will be that of the byte buffer at the moment the view is created.

      Returns:
      A new double buffer