org.vertx.scala.core.buffer

Buffer

final class Buffer extends Self

A Buffer represents a sequence of zero or more bytes that can be written to or read from, and which expands as necessary to accommodate any bytes written to it.

There are two ways to write data to a Buffer: The first method involves methods that take the form setXXX. These methods write data into the buffer starting at the specified position. The position does not have to be inside data that has already been written to the buffer; the buffer will automatically expand to encompass the position plus any data that needs to be written. All positions are measured in bytes and start with zero.

The second method involves methods that take the form appendXXX; these methods append data at the end of the buffer.

Methods exist to both set and append all primitive types, java.lang.String}, java.nio.ByteBuffer and other instances of Buffer.

Data can be read from a buffer by invoking methods which take the form getXXX. These methods take a parameter representing the position in the Buffer from where to read data.

Once a buffer has been written to a socket or other write stream, the same buffer instance can't be written again to another WriteStream.

Instances of this class are not thread-safe.

Linear Supertypes
Self, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Buffer
  2. Self
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def append[T](value: T, offset: Int, len: Int)(implicit arg0: BufferSeekType[T]): Buffer

    Appends the specified T starting at the offset using len to the end of this Buffer.

    Appends the specified T starting at the offset using len to the end of this Buffer. The buffer will expand as necessary to accommodate any bytes written.

    Returns a reference to this so multiple operations can be appended together.

    Exceptions thrown
    IllegalArgumentException

    if len is less than 0

    IndexOutOfBoundsException

    if the specified offset is less than 0, if offset + len is greater than the buffer's capacity

  7. def append[T](value: T)(implicit arg0: BufferType[T]): Buffer

    Appends the specified T to the end of the Buffer.

    Appends the specified T to the end of the Buffer. The buffer will expand as necessary to accommodate any bytes written.

    Returns a reference to this so multiple operations can be appended together.

    value

    The value to append to the Buffer.

    returns

    A reference to this so multiple operations can be appended together.

  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. val asJava: java.core.buffer.Buffer

  10. def canEqual(other: Any): Boolean

  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def copy(): Buffer

    Returns a copy of the entire Buffer.

  13. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. def equals(other: Any): Boolean

    Definition Classes
    Buffer → AnyRef → Any
  15. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def getBuffer(start: Int, end: Int): Buffer

    Returns a copy of a sub-sequence the Buffer as a org.vertx.scala.core.buffer.Buffer starting at position start and ending at position end - 1

  17. def getByte(pos: Int): Byte

    Returns the byte at position pos in the Buffer.

    Returns the byte at position pos in the Buffer.

    Exceptions thrown
    IndexOutOfBoundsException

    if the specified pos is less than 0 or pos + 1 is greater than the length of the Buffer.

  18. def getByteBuf: ByteBuf

    Returns the Buffer as a Netty ByteBuf.

    Returns the Buffer as a Netty ByteBuf.

    This method is meant for internal use only.

  19. def getBytes(start: Int, end: Int): Array[Byte]

    Returns a copy of a sub-sequence the Buffer as a byte[] starting at position start and ending at position end - 1

  20. def getBytes: Array[Byte]

    Returns a copy of the entire Buffer as a byte[]

  21. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  22. def getDouble(pos: Int): Double

    Returns the double at position pos in the Buffer.

    Returns the double at position pos in the Buffer.

    Exceptions thrown
    IndexOutOfBoundsException

    if the specified pos is less than 0 or pos + 8 is greater than the length of the Buffer.

  23. def getFloat(pos: Int): Float

    Returns the float at position pos in the Buffer.

    Returns the float at position pos in the Buffer.

    Exceptions thrown
    IndexOutOfBoundsException

    if the specified pos is less than 0 or pos + 4 is greater than the length of the Buffer.

  24. def getInt(pos: Int): Int

    Returns the int at position pos in the Buffer.

    Returns the int at position pos in the Buffer.

    Exceptions thrown
    IndexOutOfBoundsException

    if the specified pos is less than 0 or pos + 4 is greater than the length of the Buffer.

  25. def getLong(pos: Int): Long

    Returns the long at position pos in the Buffer.

    Returns the long at position pos in the Buffer.

    Exceptions thrown
    IndexOutOfBoundsException

    if the specified pos is less than 0 or pos + 8 is greater than the length of the Buffer.

  26. def getShort(pos: Int): Short

    Returns the short at position pos in the Buffer.

    Returns the short at position pos in the Buffer.

    Exceptions thrown
    IndexOutOfBoundsException

    if the specified pos is less than 0 or pos + 2 is greater than the length of the Buffer.

  27. def getString(start: Int, end: Int): String

    Returns a copy of a sub-sequence the Buffer as a String starting at position start and ending at position end - 1 interpreted as a String in UTF-8 encoding

  28. def getString(start: Int, end: Int, enc: String): String

    Returns a copy of a sub-sequence the Buffer as a String starting at position start and ending at position end - 1 interpreted as a String in the specified encoding

  29. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  30. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  31. def length(): Int

    Returns the length of the buffer, measured in bytes.

    Returns the length of the buffer, measured in bytes. All positions are indexed from zero.

  32. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  33. final def notify(): Unit

    Definition Classes
    AnyRef
  34. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  35. def setBuffer(pos: Int, b: Buffer, offset: Int, len: Int): Buffer

    Sets the bytes at position pos in the Buffer to the bytes represented by the Buffer b on the given offset and len.

    Sets the bytes at position pos in the Buffer to the bytes represented by the Buffer b on the given offset and len.

    The buffer will expand as necessary to accommodate any value written.

  36. def setBuffer(pos: Int, b: Buffer): Buffer

    Sets the bytes at position pos in the Buffer to the bytes represented by the Buffer b.

    Sets the bytes at position pos in the Buffer to the bytes represented by the Buffer b.

    The buffer will expand as necessary to accommodate any value written.

  37. def setByte(pos: Int, b: Byte): Buffer

    Sets the byte at position pos in the Buffer to the value b.

    Sets the byte at position pos in the Buffer to the value b.

    The buffer will expand as necessary to accommodate any value written.

  38. def setBytes(pos: Int, b: Array[Byte], offset: Int, len: Int): Buffer

    Sets the given number of bytes at position pos in the Buffer to the bytes represented by the byte[] b.

    Sets the given number of bytes at position pos in the Buffer to the bytes represented by the byte[] b.

    The buffer will expand as necessary to accommodate any value written.

    Exceptions thrown
    IllegalArgumentException

    if len is less than 0

    IndexOutOfBoundsException

    if the specified offset is less than 0, if offset + len is greater than the buffer's capacity, or if pos + length is greater than b.length

  39. def setBytes(pos: Int, b: Array[Byte]): Buffer

    Sets the bytes at position pos in the Buffer to the bytes represented by the byte[] b.

    Sets the bytes at position pos in the Buffer to the bytes represented by the byte[] b.

    The buffer will expand as necessary to accommodate any value written.

  40. def setBytes(pos: Int, b: ByteBuffer): Buffer

    Sets the bytes at position pos in the Buffer to the bytes represented by the ByteBuffer b.

    Sets the bytes at position pos in the Buffer to the bytes represented by the ByteBuffer b.

    The buffer will expand as necessary to accommodate any value written.

  41. def setDouble(pos: Int, d: Double): Buffer

    Sets the double at position pos in the Buffer to the value d.

    Sets the double at position pos in the Buffer to the value d.

    The buffer will expand as necessary to accommodate any value written.

  42. def setFloat(pos: Int, f: Float): Buffer

    Sets the float at position pos in the Buffer to the value f.

    Sets the float at position pos in the Buffer to the value f.

    The buffer will expand as necessary to accommodate any value written.

  43. def setInt(pos: Int, i: Int): Buffer

    Sets the int at position pos in the Buffer to the value i.

    Sets the int at position pos in the Buffer to the value i.

    The buffer will expand as necessary to accommodate any value written.

  44. def setLong(pos: Int, l: Long): Buffer

    Sets the long at position pos in the Buffer to the value l.

    Sets the long at position pos in the Buffer to the value l.

    The buffer will expand as necessary to accommodate any value written.

  45. def setShort(pos: Int, s: Short): Buffer

    Sets the short at position pos in the Buffer to the value s.

    Sets the short at position pos in the Buffer to the value s.

    The buffer will expand as necessary to accommodate any value written.

  46. def setString(pos: Int, str: String, enc: String): Buffer

    Sets the bytes at position pos in the Buffer to the value of str encoded in encoding enc.

    Sets the bytes at position pos in the Buffer to the value of str encoded in encoding enc.

    The buffer will expand as necessary to accommodate any value written.

  47. def setString(pos: Int, str: String): Buffer

    Sets the bytes at position pos in the Buffer to the value of str encoded in UTF-8.

    Sets the bytes at position pos in the Buffer to the value of str encoded in UTF-8.

    The buffer will expand as necessary to accommodate any value written.

  48. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  49. def toString(enc: String): String

    Returns a String representation of the Buffer with the encoding specified by enc

    Returns a String representation of the Buffer with the encoding specified by enc

    enc

    The encoding to use to compute the String.

    returns

    A string representation of the Buffer.

  50. def toString(): String

    Returns a String representation of the Buffer assuming it contains a String encoding in UTF-8.

    Returns a String representation of the Buffer assuming it contains a String encoding in UTF-8.

    returns

    A string representation of the Buffer.

    Definition Classes
    Buffer → AnyRef → Any
  51. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. def wrap[X](doStuff: ⇒ X): Buffer.this.type

    Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types

    Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types

    Attributes
    protected[this]
    Definition Classes
    Self

Inherited from Self

Inherited from AnyRef

Inherited from Any

Ungrouped