Packages

c

zio.nio

ByteBuffer

class ByteBuffer extends Buffer[Byte]

A mutable buffer of bytes.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ByteBuffer
  2. Buffer
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ByteBuffer(buffer: java.nio.ByteBuffer)
    Attributes
    protected[nio]

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def array(implicit trace: Trace): UIO[Array[Byte]]
    Attributes
    protected[nio]
    Definition Classes
    ByteBufferBuffer
  5. final def asCharBuffer(implicit trace: Trace): UIO[CharBuffer]
  6. final def asDoubleBuffer(implicit trace: Trace): UIO[DoubleBuffer]
  7. final def asFloatBuffer(implicit trace: Trace): UIO[FloatBuffer]
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. final def asIntBuffer(implicit trace: Trace): UIO[IntBuffer]
  10. final def asLongBuffer(implicit trace: Trace): UIO[LongBuffer]
  11. final def asReadOnlyBuffer(implicit trace: Trace): UIO[ByteBuffer]

    Creates a read-only view of this buffer.

    Creates a read-only view of this buffer.

    Definition Classes
    ByteBufferBuffer
  12. final def asShortBuffer(implicit trace: Trace): UIO[ShortBuffer]
  13. val buffer: java.nio.ByteBuffer
    Attributes
    protected[nio]
    Definition Classes
    ByteBufferBuffer
  14. final def capacity: Int

    Returns this buffer's capacity.

    Returns this buffer's capacity.

    Definition Classes
    Buffer
  15. final def clear(implicit trace: Trace): UIO[Unit]

    Clears this buffer.

    Clears this buffer. The position is set to zero, the limit is set to the capacity, and the mark is discarded. No values in the buffer are actually cleared, but this is typically used before putting new values into a buffer, after all its contents have been processed.

    If the buffer's current values have not been completely processed, then the compact method may be more appropriate.

    Definition Classes
    Buffer
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  17. final def compact(implicit trace: Trace): UIO[Unit]

    Compacts this buffer (optional operation).

    Compacts this buffer (optional operation). The bytes between the buffer's current position and its limit, if any, are copied to the beginning of the buffer. That is, the byte at index p = position() is copied to index 0, the byte at index p + 1 is copied to index 1, and so forth until the byte at index limit() - 1 is copied to index n = limit() - 1 - p. The buffer's position is then set to n+1 and its limit is set to its capacity. The mark, if defined, is discarded.

    The buffer's position is set to the number of bytes copied, rather than to zero, so that an invocation of this method can be followed immediately by an invocation of another relative put method.

    Invoke this method after writing data from a buffer in case the write was incomplete.

    Dies with ReadOnlyBufferException if this buffer is read-only.

    Definition Classes
    ByteBufferBuffer
  18. final def duplicate(implicit trace: Trace): UIO[ByteBuffer]

    Creates a new buffer that shares this buffer's content.

    Creates a new 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, limit, and mark values will be independent.

    The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer.

    Definition Classes
    ByteBufferBuffer
  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  21. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  22. final def flip(implicit trace: Trace): UIO[Unit]

    Flips this buffer.

    Flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it is discarded. After a sequence of channel-read or put operations, invoke this method to prepare for a sequence of channel-write or relative get operations.

    This method is often used in conjunction with the compact method when transferring data from one place to another.

    Definition Classes
    Buffer
  23. final def get(i: Int)(implicit trace: Trace): UIO[Byte]

    Absolute get of a single element.

    Absolute get of a single element. Reads the element at the given index. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit.

    Definition Classes
    ByteBufferBuffer
  24. final def get(implicit trace: Trace): UIO[Byte]

    Relative get of a single element.

    Relative get of a single element. Reads the element at the position and increments the position.

    Dies with BufferUnderflowException If there are no elements remaining.

    Definition Classes
    ByteBufferBuffer
  25. final def getChar(index: Int)(implicit trace: Trace): UIO[Char]

    Absolute get of a single character.

    Absolute get of a single character. Reads the character at the given index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-1.

  26. final def getChar(implicit trace: Trace): UIO[Char]

    Relative get of a single character.

    Relative get of a single character. Reads the character at the position using the current byte order and increments the position by 2.

    Dies with BufferUnderflowException If there are fewer than 2 bytes remaining.

  27. final def getChunk(maxLength: Int = Int.MaxValue)(implicit trace: Trace): UIO[Chunk[Byte]]

    Reads bytes from the current position and returns them in a Chunk.

    Reads bytes from the current position and returns them in a Chunk.

    maxLength

    Defaults to Int.MaxValue, meaning all remaining elements will be read.

    Definition Classes
    ByteBufferBuffer
  28. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. final def getDouble(index: Int)(implicit trace: Trace): UIO[Double]

    Absolute get of a single double.

    Absolute get of a single double. Reads the double at the given index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-7.

  30. final def getDouble(implicit trace: Trace): UIO[Double]

    Relative get of a single double.

    Relative get of a single double. Reads the double at the position using the current byte order and increments the position by 8.

    Dies with BufferUnderflowException If there are fewer than 8 bytes remaining.

  31. final def getFloat(index: Int)(implicit trace: Trace): UIO[Float]

    Absolute get of a single float.

    Absolute get of a single float. Reads the float at the given index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-3.

  32. final def getFloat(implicit trace: Trace): UIO[Float]

    Relative get of a single float.

    Relative get of a single float. Reads the float at the position using the current byte order and increments the position by 4.

    Dies with BufferUnderflowException If there are fewer than 4 bytes remaining.

  33. final def getInt(index: Int)(implicit trace: Trace): UIO[Int]

    Absolute get of a single int.

    Absolute get of a single int. Reads the int at the given index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-3.

  34. final def getInt(implicit trace: Trace): UIO[Int]

    Relative get of a single int.

    Relative get of a single int. Reads the int at the position using the current byte order and increments the position by 4.

    Dies with BufferUnderflowException If there are fewer than 4 bytes remaining.

  35. final def getLong(index: Int)(implicit trace: Trace): UIO[Long]

    Absolute get of a single long.

    Absolute get of a single long. Reads the long at the given index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-7.

  36. final def getLong(implicit trace: Trace): UIO[Long]

    Relative get of a single long.

    Relative get of a single long. Reads the long at the position using the current byte order and increments the position by 8.

    Dies with BufferUnderflowException If there are fewer than 8 bytes remaining.

  37. final def getShort(index: Int)(implicit trace: Trace): UIO[Short]

    Absolute get of a single short.

    Absolute get of a single short. Reads the short at the given index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-1.

  38. final def getShort(implicit trace: Trace): UIO[Short]

    Relative get of a single short.

    Relative get of a single short. Reads the short at the position using the current byte order and increments the position by 2.

    Dies with BufferUnderflowException If there are fewer than 2 bytes remaining.

  39. final def hasArray: Boolean

    Indicates if this buffer is backed by an array on the heap.

    Indicates if this buffer is backed by an array on the heap.

    The underlying array can be used in a safe way via the withArray method.

    Definition Classes
    Buffer
  40. final def hasRemaining(implicit trace: Trace): UIO[Boolean]

    Indicates whether there are any elements between this buffer's position and its limit.

    Indicates whether there are any elements between this buffer's position and its limit.

    Definition Classes
    Buffer
  41. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  42. final def isDirect: Boolean

    Indicates if this buffer was directly allocated.

    Indicates if this buffer was directly allocated.

    Returns true for directly allocated ByteBuffers and view buffers created from them.

    Definition Classes
    Buffer
  43. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  44. final def isReadOnly: Boolean

    Indicates if this buffer is read-only.

    Indicates if this buffer is read-only.

    Calling any put methods on a read-only buffer with throw ReadOnlyBufferException.

    Definition Classes
    Buffer
  45. final def limit(newLimit: Int)(implicit trace: Trace): UIO[Unit]

    Sets this buffer's limit.

    Sets this buffer's limit.

    Dies with IllegalArgumentException if the new limit is outside the bounds.

    newLimit

    Must be >= 0 and <= this buffer's capacity.

    Definition Classes
    Buffer
  46. final def limit(implicit trace: Trace): UIO[Int]

    Returns this buffer's limit.

    Returns this buffer's limit.

    Definition Classes
    Buffer
  47. final def mark(implicit trace: Trace): UIO[Unit]

    Sets this buffer's mark to the current position.

    Sets this buffer's mark to the current position.

    Definition Classes
    Buffer
  48. final def moveLimit(delta: Int)(implicit trace: Trace): UIO[Int]

    Moves this buffer's limit forward or backwards by a delta.

    Moves this buffer's limit forward or backwards by a delta.

    delta

    The number of elements to move, negative to move backwards.

    returns

    The new limit.

    Definition Classes
    Buffer
  49. final def movePosition(delta: Int)(implicit trace: Trace): UIO[Int]

    Moves this buffer's position forward or backwards by a delta.

    Moves this buffer's position forward or backwards by a delta.

    delta

    The number of elements to move, negative to move backwards.

    returns

    The new position.

    Definition Classes
    Buffer
  50. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  51. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  52. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  53. def order(o: ByteOrder)(implicit trace: Trace): UIO[Unit]

    Changes the byte order used by this buffer for multi-byte reads and view buffers.

  54. final def order(implicit trace: Trace): UIO[ByteOrder]

    The byte order used for reading multiple byte values.

    The byte order used for reading multiple byte values.

    Also the byte order used any view buffers created from this buffer.

    Definition Classes
    ByteBufferBuffer
  55. final def position(newPosition: Int)(implicit trace: Trace): UIO[Unit]

    Sets this buffer's position.

    Sets this buffer's position.

    Dies with IllegalArgumentException if the new position is outside the bounds.

    newPosition

    Must be >= 0 and <= the current limit.

    Definition Classes
    Buffer
  56. final def position(implicit trace: Trace): UIO[Int]

    Returns this buffer's position.

    Returns this buffer's position.

    Definition Classes
    Buffer
  57. final def put(index: Int, element: Byte)(implicit trace: Trace): UIO[Unit]

    Absolute put of a single element.

    Absolute put of a single element. Writes the element at the specified index. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit. Dies with ReadOnlyBufferException if this is a read-only buffer.

    Definition Classes
    ByteBufferBuffer
  58. final def put(element: Byte)(implicit trace: Trace): UIO[Unit]

    Relative put of a single element.

    Relative put of a single element. Writes the element at the position and increments the position.

    Dies with BufferOverflowException if there are no elements remaining. Dies with ReadOnlyBufferException if this is a read-only buffer.

    Definition Classes
    ByteBufferBuffer
  59. def putByteBuffer(source: ByteBuffer)(implicit trace: Trace): UIO[Unit]
  60. final def putChar(index: Int, value: Char)(implicit trace: Trace): UIO[Unit]

    Absolute put of a single character.

    Absolute put of a single character. Writes the character at the specified index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-1. Dies with ReadOnlyBufferException if this is a read-only buffer.

  61. final def putChar(value: Char)(implicit trace: Trace): UIO[Unit]

    Relative put of a single character.

    Relative put of a single character. Writes the character at the position using the current byte order and increments the position by 2.

    Dies with BufferOverflowException if there are fewer than 2 bytes remaining. Dies with ReadOnlyBufferException if this is a read-only buffer.

  62. final def putChunk(chunk: Chunk[Byte])(implicit trace: Trace): UIO[Chunk[Byte]]

    Relative put of multiple elements.

    Relative put of multiple elements. Writes as many elements as can fit in remaining buffer space, returning any elements that did not fit.

    returns

    The remaining elements that could not fit in this buffer, if any.

    Definition Classes
    Buffer
  63. final def putChunkAll(chunk: Chunk[Byte])(implicit trace: Trace): UIO[Unit]

    Tries to put an entire chunk in this buffer, possibly overflowing.

    Tries to put an entire chunk in this buffer, possibly overflowing.

    putChunk is a safe public variant of this that won't overflow.

    Attributes
    protected
    Definition Classes
    ByteBufferBuffer
  64. final def putDouble(index: Int, value: Double)(implicit trace: Trace): UIO[Unit]

    Absolute put of a single double.

    Absolute put of a single double. Writes the double at the specified index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-7. Dies with ReadOnlyBufferException if this is a read-only buffer.

  65. final def putDouble(value: Double)(implicit trace: Trace): UIO[Unit]

    Relative put of a single double.

    Relative put of a single double. Writes the double at the position using the current byte order and increments the position by 8.

    Dies with BufferOverflowException if there are fewer than 8 bytes remaining. Dies with ReadOnlyBufferException if this is a read-only buffer.

  66. final def putFloat(index: Int, value: Float)(implicit trace: Trace): UIO[Unit]

    Absolute put of a single float.

    Absolute put of a single float. Writes the float at the specified index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-3. Dies with ReadOnlyBufferException if this is a read-only buffer.

  67. final def putFloat(value: Float)(implicit trace: Trace): UIO[Unit]

    Relative put of a single float.

    Relative put of a single float. Writes the float at the position using the current byte order and increments the position by 4.

    Dies with BufferOverflowException if there are fewer than 4 bytes remaining. Dies with ReadOnlyBufferException if this is a read-only buffer.

  68. final def putInt(index: Int, value: Int)(implicit trace: Trace): UIO[Unit]

    Absolute put of a single int.

    Absolute put of a single int. Writes the int at the specified index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-3. Dies with ReadOnlyBufferException if this is a read-only buffer.

  69. final def putInt(value: Int)(implicit trace: Trace): UIO[Unit]

    Relative put of a single int.

    Relative put of a single int. Writes the int at the position using the current byte order and increments the position by 4.

    Dies with BufferOverflowException if there are fewer than 4 bytes remaining. Dies with ReadOnlyBufferException if this is a read-only buffer.

  70. final def putLong(index: Int, value: Long)(implicit trace: Trace): UIO[Unit]

    Absolute put of a single long.

    Absolute put of a single long. Writes the long at the specified index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-7. Dies with ReadOnlyBufferException if this is a read-only buffer.

  71. final def putLong(value: Long)(implicit trace: Trace): UIO[Unit]

    Relative put of a single long.

    Relative put of a single long. Writes the long at the position using the current byte order and increments the position by 8.

    Dies with BufferOverflowException if there are fewer than 8 bytes remaining. Dies with ReadOnlyBufferException if this is a read-only buffer.

  72. final def putShort(index: Int, value: Short)(implicit trace: Trace): UIO[Unit]

    Absolute put of a single short.

    Absolute put of a single short. Writes the short at the specified index using the current byte order. The position does not change.

    Dies with IndexOutOfBoundsException if the index is negative or not smaller than the limit-1. Dies with ReadOnlyBufferException if this is a read-only buffer.

  73. final def putShort(value: Short)(implicit trace: Trace): UIO[Unit]

    Relative put of a single short.

    Relative put of a single short. Writes the short at the position using the current byte order and increments the position by 2.

    Dies with BufferOverflowException if there are fewer than 2 bytes remaining. Dies with ReadOnlyBufferException if this is a read-only buffer.

  74. final def remaining(implicit trace: Trace): UIO[Int]

    Returns the number of elements between this buffer's position and its limit.

    Returns the number of elements between this buffer's position and its limit.

    Definition Classes
    Buffer
  75. final def reset(implicit trace: Trace): UIO[Unit]

    Resets the position to the previously set mark.

    Resets the position to the previously set mark. A mark must be set before calling this.

    Dies with InvalidMarkException if a mark has not previously been set.

    Definition Classes
    Buffer
  76. final def rewind(implicit trace: Trace): UIO[Unit]

    Rewinds this buffer.

    Rewinds this buffer. The position is set to zero and the mark is discarded. Invoke this method before a sequence of channel-write or get operations, assuming that the limit has already been set appropriately.

    Definition Classes
    Buffer
  77. final def slice(implicit trace: Trace): UIO[ByteBuffer]

    Creates a new buffer whose content is a shared subsequence of this buffer's content.

    Creates a new 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, limit, and mark 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.

    Definition Classes
    ByteBufferBuffer
  78. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  79. def toString(): String
    Definition Classes
    AnyRef → Any
  80. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  81. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  82. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  83. final def withArray[R, E, B](noArray: ZIO[R, E, B], hasArray: (Array[Byte], Int) => ZIO[R, E, B])(implicit trace: Trace): ZIO[R, E, B]

    Perform effects using this buffer's underlying array directly.

    Perform effects using this buffer's underlying array directly. Because only some buffers are backed by arrays, two cases must be handled. Ideally, the same result is produced in each case, with the hasArray variant just being more efficient.

    For the hasArray case, the function is provided the backing array itself and an offset within that array which contains the first element of this buffer. Elements in the array before the offset are not contained in this buffer.

    noArray

    The effect to perform if this buffer is not backed by an array.

    hasArray

    The effect to perform if this buffer is backed by an array.

    Definition Classes
    Buffer
  84. def withJavaBuffer[R, E, A](f: (java.nio.ByteBuffer) => ZIO[R, E, A])(implicit trace: Trace): ZIO[R, E, A]

    Provides the underlying Java byte buffer for use in an effect.

    Provides the underlying Java byte buffer for use in an effect.

    This is useful when using Java APIs that require a Java byte buffer to be provided.

    returns

    The effect value constructed by f using the underlying buffer.

Inherited from Buffer[Byte]

Inherited from AnyRef

Inherited from Any

Ungrouped