2020-08-28 14:02:51 +02: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:
|
|
|
|
*
|
|
|
|
* http://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.
|
|
|
|
*/
|
2020-08-24 17:13:04 +02:00
|
|
|
package io.netty.buffer.b2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A reference counted buffer API with separate reader and writer indexes.
|
|
|
|
*/
|
2020-08-28 12:17:41 +02:00
|
|
|
public interface Buf extends Rc<Buf> {
|
|
|
|
/**
|
|
|
|
* The capacity of this buffer, that is, the maximum number of bytes it can contain.
|
|
|
|
*
|
|
|
|
* @return The capacity in bytes.
|
|
|
|
*/
|
|
|
|
int capacity();
|
|
|
|
|
2020-08-24 17:13:04 +02:00
|
|
|
/**
|
|
|
|
* Get the current reader index. The next read will happen from this byte index into the buffer.
|
|
|
|
*
|
|
|
|
* @return The current reader index.
|
|
|
|
*/
|
|
|
|
int readerIndex();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the reader index. Make the next read happen from the given index.
|
|
|
|
*
|
|
|
|
* @param index The reader index to set.
|
|
|
|
* @return This Buf.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the specified {@code index} is less than zero or greater than the current
|
|
|
|
* {@link #writerIndex()}.
|
2020-08-24 17:13:04 +02:00
|
|
|
*/
|
2020-08-28 12:17:41 +02:00
|
|
|
Buf readerIndex(int index);
|
2020-08-24 17:13:04 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current writer index. The next write will happen at this byte index into the byffer.
|
|
|
|
*
|
|
|
|
* @return The current writer index.
|
|
|
|
*/
|
|
|
|
int writerIndex();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the writer index. Make the next write happen at the given index.
|
|
|
|
*
|
|
|
|
* @param index The writer index to set.
|
|
|
|
* @return This Buf.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the specified {@code index} is less than the current {@link #readerIndex()}
|
|
|
|
* or greater than {@link #capacity()}.
|
|
|
|
*/
|
|
|
|
Buf writerIndex(int index);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the number of readable bytes which is equal to {@code (writerIndex() - readerIndex())}.
|
|
|
|
*/
|
|
|
|
int readableBytes();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the number of writable bytes which is equal to {@code (capacity() - writerIndex())}.
|
|
|
|
*/
|
|
|
|
int writableBytes();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill the buffer with the given byte value. This method does not respect the {@link #readerIndex()} or {@link
|
|
|
|
* #writerIndex()}, but copies the full capacity of the buffer. The {@link #readerIndex()} and {@link
|
|
|
|
* #writerIndex()} are not modified.
|
|
|
|
*
|
|
|
|
* @param value The byte value to write at every index in the buffer.
|
|
|
|
* @return This Buf.
|
|
|
|
*/
|
|
|
|
Buf fill(byte value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a byte array, and fill it with the complete contents of this buffer. This method does not respect the
|
|
|
|
* {@link #readerIndex()} or {@link #writerIndex()}, but copies the full capacity of the buffer. The {@link
|
|
|
|
* #readerIndex()} and {@link #writerIndex()} are not modified.
|
|
|
|
*
|
|
|
|
* @return A byte array that contains a copy of the contents of this buffer.
|
|
|
|
*/
|
|
|
|
byte[] copy();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Give the native memory address backing this buffer, or return 0 if this is a heap backed buffer.
|
|
|
|
* @return The native memory address, if any, otherwise 0.
|
|
|
|
*/
|
|
|
|
long getNativeAddress();
|
|
|
|
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
// ### CODEGEN START primitive accessors interface
|
Make cleaner in pooledDirectWithCleaner return segments to pool instead of deallocating
Motivation:
Allocating memory is expensive, which is why we pool our allocations.
The cleaner, when used with pooled memory, should then return that memory to the pool instead of deallocating it.
The purpose of the cleaner is, after all, to avoid having to track the reference counts so precisely.
Modification:
The NativeMemoryCleanerDrop is now able to either recover lost memory segments, when a buffer wasn't closed explicitly
and is being cleaned by the GC, or return the buffer to the pool via ordinary drop.
The GatedCleanable has been added, because buffer ownership transfer involves generating new memory segments,
and in those cases we need to invalidate the old cleanables without deallocating the tracked memory segment or returning
it to the pool more than once.
Result:
The pooledDirectWithCleaner allocator is now able to reuse memory segments, even when their references are forgotten and
they processed by the cleaner thread.
2020-09-25 12:15:45 +02:00
|
|
|
// <editor-fold defaultstate="collapsed" desc="Generated primitive accessors interface.">
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
|
2020-08-28 12:17:41 +02:00
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the byte value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Byte#BYTES}.
|
|
|
|
* The value is read using a two's complement 8-bit encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @return The byte value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Byte#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
|
|
|
byte readByte();
|
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the byte value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 8-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The byte value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
byte readByte(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned byte value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Byte#BYTES}.
|
|
|
|
* The value is read using an unsigned two's complement 8-bit encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using an unsigned two's complement 8-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The unsigned byte value at the given offset.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Byte#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
int readUnsignedByte(int roff);
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Set the given byte value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Byte#BYTES}.
|
|
|
|
* The value is written using a two's complement 8-bit encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
|
|
|
* @param value The byte value to write.
|
|
|
|
* @return This Buf.
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Byte#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
|
|
|
Buf writeByte(byte value);
|
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Set the given byte value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 8-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeByte(int woff, byte value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned byte value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Byte#BYTES}.
|
|
|
|
* The value is written using an unsigned two's complement 8-bit encoding, with big-endian 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned byte value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using an unsigned two's complement 8-bit encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @param value The int value to write.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @return This Buf.
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedByte(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the char value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by 2.
|
|
|
|
* The value is read using a 2-byte UTF-16 encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a 2-byte UTF-16 encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The char value at the given offset.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 2.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
char readChar(int roff);
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the char value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by 2.
|
|
|
|
* The value is read using a 2-byte UTF-16 encoding, with little-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @return The char value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than 2.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
char readCharLE();
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the char value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a 2-byte UTF-16 encoding, with little-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The char value at the given offset.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 2.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
char readCharLE(int roff);
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Set the given char value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by 2.
|
|
|
|
* The value is written using a 2-byte UTF-16 encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param value The char value to write.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @return This Buf.
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than 2.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
Buf writeChar(char value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given char value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a 2-byte UTF-16 encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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.
|
|
|
|
*/
|
|
|
|
Buf writeChar(int woff, char value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given char value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by 2.
|
|
|
|
* The value is written using a 2-byte UTF-16 encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param value The char value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than 2.
|
|
|
|
*/
|
|
|
|
Buf writeCharLE(char value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given char value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a 2-byte UTF-16 encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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.
|
|
|
|
*/
|
|
|
|
Buf writeCharLE(int woff, char value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the short value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Short#BYTES}.
|
|
|
|
* The value is read using a two's complement 16-bit encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 16-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The short value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
short readShort(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the short value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Short#BYTES}.
|
|
|
|
* The value is read using a two's complement 16-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @return The short value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Short#BYTES}.
|
|
|
|
*/
|
|
|
|
short readShortLE();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the short value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 16-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The short value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
short readShortLE(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned short value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Short#BYTES}.
|
|
|
|
* The value is read using an unsigned two's complement 16-bit encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using an unsigned two's complement 16-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The unsigned short value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
int readUnsignedShort(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned short value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Short#BYTES}.
|
|
|
|
* The value is read using an unsigned two's complement 16-bit encoding, with little-endian 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 readUnsignedShortLE();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned short value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using an unsigned two's complement 16-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The unsigned short value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
int readUnsignedShortLE(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given short value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Short#BYTES}.
|
|
|
|
* The value is written using a two's complement 16-bit encoding, with big-endian 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given short value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 16-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeShort(int woff, short value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given short value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Short#BYTES}.
|
|
|
|
* The value is written using a two's complement 16-bit encoding, with little-endian 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 writeShortLE(short value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given short value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 16-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeShortLE(int woff, short value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned short value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Short#BYTES}.
|
|
|
|
* The value is written using an unsigned two's complement 16-bit encoding, with big-endian 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned short value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using an unsigned two's complement 16-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedShort(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned short value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Short#BYTES}.
|
|
|
|
* The value is written using an unsigned two's complement 16-bit encoding, with little-endian 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 writeUnsignedShortLE(int value);
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Set the given unsigned short value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using an unsigned two's complement 16-bit encoding, with little-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @param value The int value to write.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @return This Buf.
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedShortLE(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the int value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by 3.
|
|
|
|
* The value is read using a two's complement 24-bit encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 24-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The int value at the given offset.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 3.
|
|
|
|
*/
|
|
|
|
int readMedium(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the int value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by 3.
|
|
|
|
* The value is read using a two's complement 24-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @return The int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than 3.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
int readMediumLE();
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the int value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 24-bit encoding, with little-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The int value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 3.
|
|
|
|
*/
|
|
|
|
int readMediumLE(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned int value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by 3.
|
|
|
|
* The value is read using an unsigned two's complement 24-bit encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using an unsigned two's complement 24-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The unsigned int value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 3.
|
|
|
|
*/
|
|
|
|
int readUnsignedMedium(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned int value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by 3.
|
|
|
|
* The value is read using an unsigned two's complement 24-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @return The unsigned int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than 3.
|
|
|
|
*/
|
|
|
|
int readUnsignedMediumLE();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned int value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using an unsigned two's complement 24-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The unsigned int value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
|
|
|
* greater than or equal to {@link Buf#capacity()} minus 3.
|
|
|
|
*/
|
|
|
|
int readUnsignedMediumLE(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given int value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by 3.
|
|
|
|
* The value is written using a two's complement 24-bit encoding, with big-endian 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given int value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 24-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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.
|
|
|
|
*/
|
|
|
|
Buf writeMedium(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given int value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by 3.
|
|
|
|
* The value is written using a two's complement 24-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than 3.
|
|
|
|
*/
|
|
|
|
Buf writeMediumLE(int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given int value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 24-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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.
|
|
|
|
*/
|
|
|
|
Buf writeMediumLE(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned int value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by 3.
|
|
|
|
* The value is written using an unsigned two's complement 24-bit encoding, with big-endian 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned int value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using an unsigned two's complement 24-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedMedium(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned int value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by 3.
|
|
|
|
* The value is written using an unsigned two's complement 24-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than 3.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedMediumLE(int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned int value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using an unsigned two's complement 24-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedMediumLE(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the int value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Integer#BYTES}.
|
|
|
|
* The value is read using a two's complement 32-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @return The int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Integer#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
|
|
|
int readInt();
|
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the int value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 32-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The int value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
int readInt(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the int value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Integer#BYTES}.
|
|
|
|
* The value is read using a two's complement 32-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @return The int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Integer#BYTES}.
|
|
|
|
*/
|
|
|
|
int readIntLE();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the int value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 32-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The int value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
int readIntLE(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned int value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Integer#BYTES}.
|
|
|
|
* The value is read using an unsigned two's complement 32-bit encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using an unsigned two's complement 32-bit encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The unsigned int value at the given offset.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Integer#BYTES}.
|
|
|
|
*/
|
|
|
|
long readUnsignedInt(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unsigned int value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Integer#BYTES}.
|
|
|
|
* The value is read using an unsigned two's complement 32-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @return The unsigned int value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Integer#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
long readUnsignedIntLE();
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the unsigned int value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using an unsigned two's complement 32-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The unsigned int value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
long readUnsignedIntLE(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given int value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Integer#BYTES}.
|
|
|
|
* The value is written using a two's complement 32-bit encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
|
|
|
* @param value The int value to write.
|
|
|
|
* @return This Buf.
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Integer#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
|
|
|
Buf writeInt(int value);
|
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Set the given int value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 32-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeInt(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given int value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Integer#BYTES}.
|
|
|
|
* The value is written using a two's complement 32-bit encoding, with little-endian 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 writeIntLE(int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given int value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 32-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeIntLE(int woff, int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned int value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Integer#BYTES}.
|
|
|
|
* The value is written using an unsigned two's complement 32-bit encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param value The long value to write.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @return This Buf.
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Integer#BYTES}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedInt(long value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned int value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using an unsigned two's complement 32-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedInt(int woff, long value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned int value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Integer#BYTES}.
|
|
|
|
* The value is written using an unsigned two's complement 32-bit encoding, with little-endian 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 writeUnsignedIntLE(long value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given unsigned int value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using an unsigned two's complement 32-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeUnsignedIntLE(int woff, long value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the float value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Float#BYTES}.
|
|
|
|
* The value is read using a 32-bit IEEE floating point encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a 32-bit IEEE floating point encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The float value at the given offset.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Float#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
float readFloat(int roff);
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the float value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Float#BYTES}.
|
|
|
|
* The value is read using a 32-bit IEEE floating point encoding, with little-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @return The float value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Float#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
float readFloatLE();
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Get the float value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a 32-bit IEEE floating point encoding, with little-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The float value at the given offset.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Float#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
float readFloatLE(int roff);
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Set the given float value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Float#BYTES}.
|
|
|
|
* The value is written using a 32-bit IEEE floating point encoding, with big-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param value The float value to write.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @return This Buf.
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#writableBytes} is less than {@link Float#BYTES}.
|
2020-08-28 12:17:41 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
Buf writeFloat(float value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given float value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a 32-bit IEEE floating point encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeFloat(int woff, float value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given float value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Float#BYTES}.
|
|
|
|
* The value is written using a 32-bit IEEE floating point encoding, with little-endian 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 writeFloatLE(float value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given float value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a 32-bit IEEE floating point encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeFloatLE(int woff, float value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the long value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Long#BYTES}.
|
|
|
|
* The value is read using a two's complement 64-bit encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 64-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The long value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
long readLong(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the long value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Long#BYTES}.
|
|
|
|
* The value is read using a two's complement 64-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @return The long value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Long#BYTES}.
|
|
|
|
*/
|
|
|
|
long readLongLE();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the long value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a two's complement 64-bit encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The long value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
long readLongLE(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given long value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Long#BYTES}.
|
|
|
|
* The value is written using a two's complement 64-bit encoding, with big-endian 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given long value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 64-bit encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeLong(int woff, long value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given long value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Long#BYTES}.
|
|
|
|
* The value is written using a two's complement 64-bit encoding, with little-endian 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 writeLongLE(long value);
|
2020-08-28 12:17:41 +02:00
|
|
|
|
|
|
|
/**
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* Set the given long value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a two's complement 64-bit encoding, with little-endian byte order.
|
2020-08-28 12:17:41 +02:00
|
|
|
*
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @param value The long value to write.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @return This Buf.
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeLongLE(int woff, long value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the double value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Double#BYTES}.
|
|
|
|
* The value is read using a 64-bit IEEE floating point encoding, with big-endian 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.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a 64-bit IEEE floating point encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The double value at the given offset.
|
2020-08-28 12:17:41 +02:00
|
|
|
* @throws IndexOutOfBoundsException if the given index is out of bounds of the buffer, that is, less than 0 or
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
* greater than or equal to {@link Buf#capacity()} minus {@link Double#BYTES}.
|
|
|
|
*/
|
|
|
|
double readDouble(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the double value at the current {@link Buf#readerIndex()},
|
|
|
|
* and increases the reader offset by {@link Double#BYTES}.
|
|
|
|
* The value is read using a 64-bit IEEE floating point encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @return The double value at the current reader offset.
|
|
|
|
* @throws IndexOutOfBoundsException If {@link Buf#readableBytes} is less than {@link Double#BYTES}.
|
|
|
|
*/
|
|
|
|
double readDoubleLE();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the double value at the given reader offset.
|
|
|
|
* The {@link Buf#readerIndex()} is not modified.
|
|
|
|
* The value is read using a 64-bit IEEE floating point encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param roff The read offset, an absolute index into this buffer, to read from.
|
|
|
|
* @return The double value at the given offset.
|
|
|
|
* @throws IndexOutOfBoundsException if the given index 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}.
|
|
|
|
*/
|
|
|
|
double readDoubleLE(int roff);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given double value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Double#BYTES}.
|
|
|
|
* The value is written using a 64-bit IEEE floating point encoding, with big-endian 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given double value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a 64-bit IEEE floating point encoding, with big-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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}.
|
|
|
|
*/
|
|
|
|
Buf writeDouble(int woff, double value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given double value at the current {@link Buf#writerIndex()},
|
|
|
|
* and increase the writer offset by {@link Double#BYTES}.
|
|
|
|
* The value is written using a 64-bit IEEE floating point encoding, with little-endian 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 writeDoubleLE(double value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the given double value at the given write offset. The {@link Buf#writerIndex()} is not modified.
|
|
|
|
* The value is written using a 64-bit IEEE floating point encoding, with little-endian byte order.
|
|
|
|
*
|
|
|
|
* @param woff The write offset, an absolute index into this buffer to write to.
|
|
|
|
* @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-08-24 17:13:04 +02:00
|
|
|
*/
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
Buf writeDoubleLE(int woff, double value);
|
Make cleaner in pooledDirectWithCleaner return segments to pool instead of deallocating
Motivation:
Allocating memory is expensive, which is why we pool our allocations.
The cleaner, when used with pooled memory, should then return that memory to the pool instead of deallocating it.
The purpose of the cleaner is, after all, to avoid having to track the reference counts so precisely.
Modification:
The NativeMemoryCleanerDrop is now able to either recover lost memory segments, when a buffer wasn't closed explicitly
and is being cleaned by the GC, or return the buffer to the pool via ordinary drop.
The GatedCleanable has been added, because buffer ownership transfer involves generating new memory segments,
and in those cases we need to invalidate the old cleanables without deallocating the tracked memory segment or returning
it to the pool more than once.
Result:
The pooledDirectWithCleaner allocator is now able to reuse memory segments, even when their references are forgotten and
they processed by the cleaner thread.
2020-09-25 12:15:45 +02:00
|
|
|
// </editor-fold>
|
Generate complete and tested Buf API
Motivation:
The Buf API is wide, taking into account signedness, endian-ness, and so on, for all primitive
types.
Modification:
A code generator has been added which add API, implementation, and tests, to the Buf, BBuf,
and BBufTest files respectively.
Result:
We have a complete and fully tested accessor API in the Buf interface, which is still somewhat
easy to bulk-modify using the code generator.
2020-09-10 18:05:36 +02:00
|
|
|
// ### CODEGEN END primitive accessors interface
|
|
|
|
}
|