Class Buffer

  • All Implemented Interfaces:
    io.vertx.core.shareddata.impl.ClusterSerializable

    public class Buffer
    extends Object
    implements io.vertx.core.shareddata.impl.ClusterSerializable
    Most data is shuffled around inside Vert.x using buffers.

    A buffer is a sequence of zero or more bytes that can read from or written to and which expands automatically as necessary to accommodate any bytes written to it. You can perhaps think of a buffer as smart byte array.

    Please consult the documentation for more information on buffers.

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • Buffer

        public Buffer​(io.vertx.core.buffer.Buffer delegate)
    • Method Detail

      • getDelegate

        public io.vertx.core.buffer.Buffer getDelegate()
      • writeToBuffer

        public void writeToBuffer​(io.vertx.core.buffer.Buffer buffer)
        Specified by:
        writeToBuffer in interface io.vertx.core.shareddata.impl.ClusterSerializable
      • readFromBuffer

        public int readFromBuffer​(int pos,
                                  io.vertx.core.buffer.Buffer buffer)
        Specified by:
        readFromBuffer in interface io.vertx.core.shareddata.impl.ClusterSerializable
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • buffer

        public static Buffer buffer()
        Returns:
        the buffer
      • buffer

        public static Buffer buffer​(int initialSizeHint)
        Parameters:
        initialSizeHint - the hint, in bytes
        Returns:
        the buffer
      • buffer

        public static Buffer buffer​(String string)
        Parameters:
        string - the string
        Returns:
        the buffer
      • buffer

        public static Buffer buffer​(String string,
                                    String enc)
        Parameters:
        string - the string
        enc -
        Returns:
        the buffer
      • toString

        public String toString​(String enc)
        Parameters:
        enc -
        Returns:
      • toJsonObject

        public io.vertx.core.json.JsonObject toJsonObject()
        Returns:
      • toJsonArray

        public io.vertx.core.json.JsonArray toJsonArray()
        Returns:
      • toJson

        public Object toJson()
        Returns:
        a JSON element which can be a , , String, ...etc if the buffer contains an array, object, string, ...etc
      • getByte

        public byte getByte​(int pos)
        Parameters:
        pos -
        Returns:
      • getUnsignedByte

        public short getUnsignedByte​(int pos)
        Parameters:
        pos -
        Returns:
      • getInt

        public int getInt​(int pos)
        Parameters:
        pos -
        Returns:
      • getIntLE

        public int getIntLE​(int pos)
        Parameters:
        pos -
        Returns:
      • getUnsignedInt

        public long getUnsignedInt​(int pos)
        Parameters:
        pos -
        Returns:
      • getUnsignedIntLE

        public long getUnsignedIntLE​(int pos)
        Parameters:
        pos -
        Returns:
      • getLong

        public long getLong​(int pos)
        Parameters:
        pos -
        Returns:
      • getLongLE

        public long getLongLE​(int pos)
        Parameters:
        pos -
        Returns:
      • getDouble

        public double getDouble​(int pos)
        Parameters:
        pos -
        Returns:
      • getFloat

        public float getFloat​(int pos)
        Parameters:
        pos -
        Returns:
      • getShort

        public short getShort​(int pos)
        Parameters:
        pos -
        Returns:
      • getShortLE

        public short getShortLE​(int pos)
        Parameters:
        pos -
        Returns:
      • getUnsignedShort

        public int getUnsignedShort​(int pos)
        Parameters:
        pos -
        Returns:
      • getUnsignedShortLE

        public int getUnsignedShortLE​(int pos)
        Parameters:
        pos -
        Returns:
      • getMedium

        public int getMedium​(int pos)
        Parameters:
        pos -
        Returns:
      • getMediumLE

        public int getMediumLE​(int pos)
        Parameters:
        pos -
        Returns:
      • getUnsignedMedium

        public int getUnsignedMedium​(int pos)
        Parameters:
        pos -
        Returns:
      • getUnsignedMediumLE

        public int getUnsignedMediumLE​(int pos)
        Parameters:
        pos -
        Returns:
      • getBuffer

        public Buffer getBuffer​(int start,
                                int end)
        Parameters:
        start -
        end -
        Returns:
      • getString

        public String getString​(int start,
                                int end,
                                String enc)
        Parameters:
        start -
        end -
        enc -
        Returns:
      • getString

        public String getString​(int start,
                                int end)
        Parameters:
        start -
        end -
        Returns:
      • appendBuffer

        public Buffer appendBuffer​(Buffer buff)
        Parameters:
        buff -
        Returns:
      • appendBuffer

        public Buffer appendBuffer​(Buffer buff,
                                   int offset,
                                   int len)
        Parameters:
        buff -
        offset -
        len -
        Returns:
      • appendByte

        public Buffer appendByte​(byte b)
        Parameters:
        b -
        Returns:
      • appendUnsignedByte

        public Buffer appendUnsignedByte​(short b)
        Parameters:
        b -
        Returns:
      • appendInt

        public Buffer appendInt​(int i)
        Parameters:
        i -
        Returns:
      • appendIntLE

        public Buffer appendIntLE​(int i)
        Parameters:
        i -
        Returns:
      • appendUnsignedInt

        public Buffer appendUnsignedInt​(long i)
        Parameters:
        i -
        Returns:
      • appendUnsignedIntLE

        public Buffer appendUnsignedIntLE​(long i)
        Parameters:
        i -
        Returns:
      • appendMedium

        public Buffer appendMedium​(int i)
        Parameters:
        i -
        Returns:
      • appendMediumLE

        public Buffer appendMediumLE​(int i)
        Parameters:
        i -
        Returns:
      • appendLong

        public Buffer appendLong​(long l)
        Parameters:
        l -
        Returns:
      • appendLongLE

        public Buffer appendLongLE​(long l)
        Parameters:
        l -
        Returns:
      • appendShort

        public Buffer appendShort​(short s)
        Parameters:
        s -
        Returns:
      • appendShortLE

        public Buffer appendShortLE​(short s)
        Parameters:
        s -
        Returns:
      • appendUnsignedShort

        public Buffer appendUnsignedShort​(int s)
        Parameters:
        s -
        Returns:
      • appendUnsignedShortLE

        public Buffer appendUnsignedShortLE​(int s)
        Parameters:
        s -
        Returns:
      • appendFloat

        public Buffer appendFloat​(float f)
        Parameters:
        f -
        Returns:
      • appendDouble

        public Buffer appendDouble​(double d)
        Parameters:
        d -
        Returns:
      • appendString

        public Buffer appendString​(String str,
                                   String enc)
        Parameters:
        str -
        enc -
        Returns:
      • appendString

        public Buffer appendString​(String str)
        Parameters:
        str -
        Returns:
      • setByte

        public Buffer setByte​(int pos,
                              byte b)
        Parameters:
        pos -
        b -
        Returns:
      • setUnsignedByte

        public Buffer setUnsignedByte​(int pos,
                                      short b)
        Parameters:
        pos -
        b -
        Returns:
      • setInt

        public Buffer setInt​(int pos,
                             int i)
        Parameters:
        pos -
        i -
        Returns:
      • setIntLE

        public Buffer setIntLE​(int pos,
                               int i)
        Parameters:
        pos -
        i -
        Returns:
      • setUnsignedInt

        public Buffer setUnsignedInt​(int pos,
                                     long i)
        Parameters:
        pos -
        i -
        Returns:
      • setUnsignedIntLE

        public Buffer setUnsignedIntLE​(int pos,
                                       long i)
        Parameters:
        pos -
        i -
        Returns:
      • setMedium

        public Buffer setMedium​(int pos,
                                int i)
        Parameters:
        pos -
        i -
        Returns:
      • setMediumLE

        public Buffer setMediumLE​(int pos,
                                  int i)
        Parameters:
        pos -
        i -
        Returns:
      • setLong

        public Buffer setLong​(int pos,
                              long l)
        Parameters:
        pos -
        l -
        Returns:
      • setLongLE

        public Buffer setLongLE​(int pos,
                                long l)
        Parameters:
        pos -
        l -
        Returns:
      • setDouble

        public Buffer setDouble​(int pos,
                                double d)
        Parameters:
        pos -
        d -
        Returns:
      • setFloat

        public Buffer setFloat​(int pos,
                               float f)
        Parameters:
        pos -
        f -
        Returns:
      • setShort

        public Buffer setShort​(int pos,
                               short s)
        Parameters:
        pos -
        s -
        Returns:
      • setShortLE

        public Buffer setShortLE​(int pos,
                                 short s)
        Parameters:
        pos -
        s -
        Returns:
      • setUnsignedShort

        public Buffer setUnsignedShort​(int pos,
                                       int s)
        Parameters:
        pos -
        s -
        Returns:
      • setUnsignedShortLE

        public Buffer setUnsignedShortLE​(int pos,
                                         int s)
        Parameters:
        pos -
        s -
        Returns:
      • setBuffer

        public Buffer setBuffer​(int pos,
                                Buffer b)
        Parameters:
        pos -
        b -
        Returns:
      • setBuffer

        public Buffer setBuffer​(int pos,
                                Buffer b,
                                int offset,
                                int len)
        Parameters:
        pos -
        b -
        offset -
        len -
        Returns:
      • setString

        public Buffer setString​(int pos,
                                String str)
        Parameters:
        pos -
        str -
        Returns:
      • setString

        public Buffer setString​(int pos,
                                String str,
                                String enc)
        Parameters:
        pos -
        str -
        enc -
        Returns:
      • length

        public int length()
        Returns:
      • copy

        public Buffer copy()
        Returns:
      • slice

        public Buffer slice()
        Returns:
      • slice

        public Buffer slice​(int start,
                            int end)
        Parameters:
        start -
        end -
        Returns:
      • buffer

        public static Buffer buffer​(byte[] bytes)
        Parameters:
        bytes - the byte array
        Returns:
        the buffer
      • buffer

        public static Buffer buffer​(io.netty.buffer.ByteBuf byteBuf)
        Parameters:
        byteBuf - the Netty ByteBuf
        Returns:
        the buffer
      • toString

        public String toString​(Charset enc)
        Parameters:
        enc -
        Returns:
      • getBytes

        public byte[] getBytes()
        Returns:
      • getBytes

        public byte[] getBytes​(int start,
                               int end)
        Parameters:
        start -
        end -
        Returns:
      • getBytes

        public Buffer getBytes​(byte[] dst)
        Parameters:
        dst - the destination byte array
        Returns:
      • getBytes

        public Buffer getBytes​(byte[] dst,
                               int dstIndex)
        Parameters:
        dst - the destination byte array
        dstIndex -
        Returns:
      • getBytes

        public Buffer getBytes​(int start,
                               int end,
                               byte[] dst)
        Parameters:
        start -
        end -
        dst - the destination byte array
        Returns:
      • getBytes

        public Buffer getBytes​(int start,
                               int end,
                               byte[] dst,
                               int dstIndex)
        Parameters:
        start -
        end -
        dst - the destination byte array
        dstIndex -
        Returns:
      • appendBytes

        public Buffer appendBytes​(byte[] bytes)
        Parameters:
        bytes -
        Returns:
      • appendBytes

        public Buffer appendBytes​(byte[] bytes,
                                  int offset,
                                  int len)
        Parameters:
        bytes -
        offset -
        len -
        Returns:
      • setBytes

        public Buffer setBytes​(int pos,
                               ByteBuffer b)
        Parameters:
        pos -
        b -
        Returns:
      • setBytes

        public Buffer setBytes​(int pos,
                               byte[] b)
        Parameters:
        pos -
        b -
        Returns:
      • setBytes

        public Buffer setBytes​(int pos,
                               byte[] b,
                               int offset,
                               int len)
        Parameters:
        pos -
        b -
        offset -
        len -
        Returns:
      • getByteBuf

        public io.netty.buffer.ByteBuf getByteBuf()
        Returns:
      • newInstance

        public static Buffer newInstance​(io.vertx.core.buffer.Buffer arg)