2020-10-28 14:38:14 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2020 The Netty Project
|
|
|
|
*
|
|
|
|
* The Netty Project licenses this file to you under the Apache License,
|
|
|
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
package io.netty.buffer.b2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This interface is just the primitive data accessor methods that {@link Buf} exposes.
|
|
|
|
* It can be useful if you only need the data access methods, and perhaps wish to decorate or modify their behaviour.
|
2020-11-17 15:25:26 +01:00
|
|
|
* Usually, you'd use the {@link Buf} interface directly, since this lets you properly control the buffer reference
|
|
|
|
* count.
|
2020-10-28 14:38:14 +01:00
|
|
|
*/
|
|
|
|
public interface BufAccessors {
|
2020-11-11 23:00:08 +01:00
|
|
|
// <editor-fold defaultstate="collapsed" desc="Primitive accessors interface.">
|
2020-10-28 14:38:14 +01:00
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the byte value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Byte#BYTES}.
|
|
|
|
* The value is read using a two's complement 8-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The byte value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Byte#BYTES}.
|
|
|
|
*/
|
|
|
|
byte readByte();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the byte value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using a two's complement 8-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The byte value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Byte#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
byte getByte(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the unsigned byte value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Byte#BYTES}.
|
|
|
|
* The value is read using an unsigned two's complement 8-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The unsigned byte value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Byte#BYTES}.
|
|
|
|
*/
|
|
|
|
int readUnsignedByte();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned byte value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using an unsigned two's complement 8-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The unsigned byte value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Byte#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
int getUnsignedByte(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given byte value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Byte#BYTES}.
|
|
|
|
* The value is written using a two's complement 8-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The byte value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Byte#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeByte(byte value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given byte value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using a two's complement 8-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The byte value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Byte#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setByte(int woff, byte value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given unsigned byte value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Byte#BYTES}.
|
|
|
|
* The value is written using an unsigned two's complement 8-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Byte#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedByte(int value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given unsigned byte value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using an unsigned two's complement 8-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Byte#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setUnsignedByte(int woff, int value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the char value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by 2.
|
|
|
|
* The value is read using a 2-byte UTF-16 encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The char value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than 2.
|
|
|
|
*/
|
|
|
|
char readChar();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the char value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using a 2-byte UTF-16 encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The char value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 2.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
char getChar(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given char value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by 2.
|
|
|
|
* The value is written using a 2-byte UTF-16 encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The char value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than 2.
|
|
|
|
*/
|
|
|
|
Buf writeChar(char value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given char value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using a 2-byte UTF-16 encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The char value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 2.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setChar(int woff, char value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the short value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Short#BYTES}.
|
|
|
|
* The value is read using a two's complement 16-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The short value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Short#BYTES}.
|
|
|
|
*/
|
|
|
|
short readShort();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the short value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using a two's complement 16-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The short value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Short#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
short getShort(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the unsigned short value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Short#BYTES}.
|
|
|
|
* The value is read using an unsigned two's complement 16-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The unsigned short value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Short#BYTES}.
|
|
|
|
*/
|
|
|
|
int readUnsignedShort();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned short value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using an unsigned two's complement 16-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The unsigned short value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Short#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
int getUnsignedShort(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given short value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Short#BYTES}.
|
|
|
|
* The value is written using a two's complement 16-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The short value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Short#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeShort(short value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given short value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using a two's complement 16-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The short value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Short#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setShort(int woff, short value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given unsigned short value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Short#BYTES}.
|
|
|
|
* The value is written using an unsigned two's complement 16-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Short#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedShort(int value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given unsigned short value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using an unsigned two's complement 16-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Short#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setUnsignedShort(int woff, int value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the int value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by 3.
|
|
|
|
* The value is read using a two's complement 24-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than 3.
|
|
|
|
*/
|
|
|
|
int readMedium();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the int value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using a two's complement 24-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The int value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 3.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
int getMedium(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the unsigned int value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by 3.
|
|
|
|
* The value is read using an unsigned two's complement 24-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The unsigned int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than 3.
|
|
|
|
*/
|
|
|
|
int readUnsignedMedium();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned int value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using an unsigned two's complement 24-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The unsigned int value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 3.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
int getUnsignedMedium(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given int value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by 3.
|
|
|
|
* The value is written using a two's complement 24-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than 3.
|
|
|
|
*/
|
|
|
|
Buf writeMedium(int value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given int value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using a two's complement 24-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 3.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setMedium(int woff, int value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given unsigned int value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by 3.
|
|
|
|
* The value is written using an unsigned two's complement 24-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than 3.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedMedium(int value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given unsigned int value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using an unsigned two's complement 24-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 3.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setUnsignedMedium(int woff, int value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the int value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Integer#BYTES}.
|
|
|
|
* The value is read using a two's complement 32-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Integer#BYTES}.
|
|
|
|
*/
|
|
|
|
int readInt();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the int value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using a two's complement 32-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The int value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Integer#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
int getInt(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the unsigned int value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Integer#BYTES}.
|
|
|
|
* The value is read using an unsigned two's complement 32-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The unsigned int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Integer#BYTES}.
|
|
|
|
*/
|
|
|
|
long readUnsignedInt();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned int value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using an unsigned two's complement 32-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The unsigned int value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Integer#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
long getUnsignedInt(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given int value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Integer#BYTES}.
|
|
|
|
* The value is written using a two's complement 32-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Integer#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeInt(int value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given int value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using a two's complement 32-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Integer#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setInt(int woff, int value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given unsigned int value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Integer#BYTES}.
|
|
|
|
* The value is written using an unsigned two's complement 32-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The long value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Integer#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedInt(long value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given unsigned int value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using an unsigned two's complement 32-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The long value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Integer#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setUnsignedInt(int woff, long value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the float value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Float#BYTES}.
|
|
|
|
* The value is read using a 32-bit IEEE floating point encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The float value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Float#BYTES}.
|
|
|
|
*/
|
|
|
|
float readFloat();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the float value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using a 32-bit IEEE floating point encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The float value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Float#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
float getFloat(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given float value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Float#BYTES}.
|
|
|
|
* The value is written using a 32-bit IEEE floating point encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The float value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Float#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeFloat(float value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given float value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using a 32-bit IEEE floating point encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The float value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Float#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setFloat(int woff, float value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the long value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Long#BYTES}.
|
|
|
|
* The value is read using a two's complement 64-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The long value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Long#BYTES}.
|
|
|
|
*/
|
|
|
|
long readLong();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the long value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using a two's complement 64-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The long value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Long#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
long getLong(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given long value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Long#BYTES}.
|
|
|
|
* The value is written using a two's complement 64-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The long value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Long#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeLong(long value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given long value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using a two's complement 64-bit encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The long value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Long#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setLong(int woff, long value);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Get the double value at the current {@link Buf#readerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increases the reader offset by {@link Double#BYTES}.
|
|
|
|
* The value is read using a 64-bit IEEE floating point encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @return The double value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Double#BYTES}.
|
|
|
|
*/
|
|
|
|
double readDouble();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the double value at the given reader offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* The {@link Buf#readerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is read using a 64-bit IEEE floating point encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param roff The read offset, an absolute offset into this buffer, to read from.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @return The double value at the given offset.
|
2020-11-11 23:00:08 +01:00
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
2020-10-28 14:38:14 +01:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Double#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
double getDouble(int roff);
|
2020-10-28 14:38:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given double value at the current {@link Buf#writerOffset()},
|
2020-10-28 14:38:14 +01:00
|
|
|
* and increase the writer offset by {@link Double#BYTES}.
|
|
|
|
* The value is written using a 64-bit IEEE floating point encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
|
|
|
* @param value The double value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Double#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeDouble(double value);
|
|
|
|
|
|
|
|
/**
|
2020-11-11 23:00:08 +01:00
|
|
|
* Set the given double value at the given write offset. The {@link Buf#writerOffset()} is not modified.
|
2020-10-28 14:38:14 +01:00
|
|
|
* The value is written using a 64-bit IEEE floating point encoding,
|
|
|
|
* with the {@link Buf#order() configured} default byte order.
|
|
|
|
*
|
2020-11-11 23:00:08 +01:00
|
|
|
* @param woff The write offset, an absolute offset into this buffer to write to.
|
2020-10-28 14:38:14 +01:00
|
|
|
* @param value The double value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Double#BYTES}.
|
|
|
|
*/
|
2020-11-11 23:00:08 +01:00
|
|
|
Buf setDouble(int woff, double value);
|
2020-10-28 14:38:14 +01:00
|
|
|
// </editor-fold>
|
2020-11-17 15:25:26 +01:00
|
|
|
}
|