View Javadoc
1   /*
2    * Copyright 2021 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty5.buffer.api;
17  
18  /**
19   * This interface is just the primitive data accessor methods that {@link Buffer} exposes.
20   * It can be useful if you only need the data access methods, and perhaps wish to decorate or modify their behaviour.
21   * Usually, you'd use the {@link Buffer} interface directly, since this lets you properly control the buffer life cycle.
22   */
23  public interface BufferAccessor {
24      // <editor-fold defaultstate="collapsed" desc="Primitive accessors interface.">
25      /**
26       * Read the boolean value at the current {@link Buffer#readerOffset()},
27       * and increases the reader offset by {@link Byte#BYTES}. A boolean gets
28       * read as a byte from this buffer. All byte values which are not equal
29       * to zero are considered as the boolean value {@code true}, zero represents
30       * {@code false}.
31       *
32       * @return The boolean value at the current reader offset.
33       * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Byte#BYTES}.
34       */
35      default boolean readBoolean() {
36          return readByte() != 0;
37      }
38  
39      /**
40       * Get the boolean value at the given reader offset.
41       * The {@link Buffer#readerOffset()} is not modified.
42       * A boolean gets read as a byte from this buffer. All
43       * byte values which are not equal to zero are considered
44       * as the boolean value {@code true}, zero represents
45       * {@code false}.
46       *
47       * @param roff The read offset, an absolute offset into this buffer, to read from.
48       * @return The boolean value at the given offset.
49       * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
50       *                                   greater than {@link Buffer#capacity()} minus {@link Byte#BYTES}.
51       */
52      default boolean getBoolean(int roff) {
53          return getByte(roff) != 0;
54      }
55  
56      /**
57       * Write the given boolean value at the current {@link Buffer#writerOffset()},
58       * and increase the writer offset by {@link Byte#BYTES}. A boolean gets
59       * written as a byte to this buffer. All byte values which are not equal
60       * to zero are considered as the boolean value {@code true}, zero represents
61       * {@code false}.
62       *
63       * @param value The boolean value to write.
64       * @return This Buffer.
65       * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Byte#BYTES},
66       * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
67       */
68      default Buffer writeBoolean(boolean value) {
69          return writeByte((byte) (value ? 1 :0));
70      }
71  
72      /**
73       * Set the given boolean value at the given write offset.
74       * The {@link Buffer#writerOffset()} is not modified.
75       * A boolean gets written as a byte to this buffer. All
76       * byte values which are not equal to zero are considered
77       * as the boolean value {@code true}, zero represents
78       * {@code false}.
79       *
80       * @param woff The write offset, an absolute offset into this buffer to write to.
81       * @param value The boolean value to write.
82       * @return This Buffer.
83       * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
84       *                                   greater than {@link Buffer#capacity()} minus {@link Byte#BYTES}.
85       */
86      default Buffer setBoolean(int woff, boolean value) {
87          return setByte(woff, (byte) (value ? 1 : 0));
88      }
89  
90      /**
91       * Read the byte value at the current {@link Buffer#readerOffset()},
92       * and increases the reader offset by {@link Byte#BYTES}.
93       * The value is read using a two's complement 8-bit encoding,
94       * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
95       *
96       * @return The byte value at the current reader offset.
97       * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Byte#BYTES}.
98       */
99      byte readByte();
100 
101     /**
102      * Get the byte value at the given reader offset.
103      * The {@link Buffer#readerOffset()} is not modified.
104      * The value is read using a two's complement 8-bit encoding,
105      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
106      *
107      * @param roff The read offset, an absolute offset into this buffer, to read from.
108      * @return The byte value at the given offset.
109      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
110      *                                   greater than {@link Buffer#capacity()} minus {@link Byte#BYTES}.
111      */
112     byte getByte(int roff);
113 
114     /**
115      * Read the unsigned byte value at the current {@link Buffer#readerOffset()},
116      * and increases the reader offset by {@link Byte#BYTES}.
117      * The value is read using an unsigned two's complement 8-bit encoding,
118      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
119      *
120      * @return The unsigned byte value at the current reader offset.
121      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Byte#BYTES}.
122      */
123     int readUnsignedByte();
124 
125     /**
126      * Get the unsigned byte value at the given reader offset.
127      * The {@link Buffer#readerOffset()} is not modified.
128      * The value is read using an unsigned two's complement 8-bit encoding,
129      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
130      *
131      * @param roff The read offset, an absolute offset into this buffer, to read from.
132      * @return The unsigned byte value at the given offset.
133      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
134      *                                   greater than {@link Buffer#capacity()} minus {@link Byte#BYTES}.
135      */
136     int getUnsignedByte(int roff);
137 
138     /**
139      * Write the given byte value at the current {@link Buffer#writerOffset()},
140      * and increase the writer offset by {@link Byte#BYTES}.
141      * The value is written using a two's complement 8-bit encoding,
142      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
143      *
144      * @param value The byte value to write.
145      * @return This Buffer.
146      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Byte#BYTES},
147      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
148      */
149     Buffer writeByte(byte value);
150 
151     /**
152      * Set the given byte value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
153      * The value is written using a two's complement 8-bit encoding,
154      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
155      *
156      * @param woff The write offset, an absolute offset into this buffer to write to.
157      * @param value The byte value to write.
158      * @return This Buffer.
159      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
160      *                                   greater than {@link Buffer#capacity()} minus {@link Byte#BYTES}.
161      */
162     Buffer setByte(int woff, byte value);
163 
164     /**
165      * Write the given unsigned byte value at the current {@link Buffer#writerOffset()},
166      * and increase the writer offset by {@link Byte#BYTES}.
167      * The value is written using an unsigned two's complement 8-bit encoding,
168      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
169      *
170      * @param value The int value to write.
171      * @return This Buffer.
172      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Byte#BYTES},
173      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
174      */
175     Buffer writeUnsignedByte(int value);
176 
177     /**
178      * Set the given unsigned byte value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
179      * The value is written using an unsigned two's complement 8-bit encoding,
180      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
181      *
182      * @param woff The write offset, an absolute offset into this buffer to write to.
183      * @param value The int value to write.
184      * @return This Buffer.
185      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
186      *                                   greater than {@link Buffer#capacity()} minus {@link Byte#BYTES}.
187      */
188     Buffer setUnsignedByte(int woff, int value);
189 
190     /**
191      * Read the char value at the current {@link Buffer#readerOffset()},
192      * and increases the reader offset by 2.
193      * The value is read using a 2-byte UTF-16 encoding,
194      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
195      *
196      * @return The char value at the current reader offset.
197      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than 2.
198      */
199     char readChar();
200 
201     /**
202      * Get the char value at the given reader offset.
203      * The {@link Buffer#readerOffset()} is not modified.
204      * The value is read using a 2-byte UTF-16 encoding,
205      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
206      *
207      * @param roff The read offset, an absolute offset into this buffer, to read from.
208      * @return The char value at the given offset.
209      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
210      *                                   greater than {@link Buffer#capacity()} minus 2.
211      */
212     char getChar(int roff);
213 
214     /**
215      * Write the given char value at the current {@link Buffer#writerOffset()},
216      * and increase the writer offset by 2.
217      * The value is written using a 2-byte UTF-16 encoding,
218      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
219      *
220      * @param value The char value to write.
221      * @return This Buffer.
222      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than 2,
223      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
224      */
225     Buffer writeChar(char value);
226 
227     /**
228      * Set the given char value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
229      * The value is written using a 2-byte UTF-16 encoding,
230      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
231      *
232      * @param woff The write offset, an absolute offset into this buffer to write to.
233      * @param value The char value to write.
234      * @return This Buffer.
235      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
236      *                                   greater than {@link Buffer#capacity()} minus 2.
237      */
238     Buffer setChar(int woff, char value);
239 
240     /**
241      * Read the short value at the current {@link Buffer#readerOffset()},
242      * and increases the reader offset by {@link Short#BYTES}.
243      * The value is read using a two's complement 16-bit encoding,
244      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
245      *
246      * @return The short value at the current reader offset.
247      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Short#BYTES}.
248      */
249     short readShort();
250 
251     /**
252      * Get the short value at the given reader offset.
253      * The {@link Buffer#readerOffset()} is not modified.
254      * The value is read using a two's complement 16-bit encoding,
255      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
256      *
257      * @param roff The read offset, an absolute offset into this buffer, to read from.
258      * @return The short value at the given offset.
259      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
260      *                                   greater than {@link Buffer#capacity()} minus {@link Short#BYTES}.
261      */
262     short getShort(int roff);
263 
264     /**
265      * Read the unsigned short value at the current {@link Buffer#readerOffset()},
266      * and increases the reader offset by {@link Short#BYTES}.
267      * The value is read using an unsigned two's complement 16-bit encoding,
268      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
269      *
270      * @return The unsigned short value at the current reader offset.
271      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Short#BYTES}.
272      */
273     int readUnsignedShort();
274 
275     /**
276      * Get the unsigned short value at the given reader offset.
277      * The {@link Buffer#readerOffset()} is not modified.
278      * The value is read using an unsigned two's complement 16-bit encoding,
279      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
280      *
281      * @param roff The read offset, an absolute offset into this buffer, to read from.
282      * @return The unsigned short value at the given offset.
283      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
284      *                                   greater than {@link Buffer#capacity()} minus {@link Short#BYTES}.
285      */
286     int getUnsignedShort(int roff);
287 
288     /**
289      * Write the given short value at the current {@link Buffer#writerOffset()},
290      * and increase the writer offset by {@link Short#BYTES}.
291      * The value is written using a two's complement 16-bit encoding,
292      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
293      *
294      * @param value The short value to write.
295      * @return This Buffer.
296      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Short#BYTES},
297      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
298      */
299     Buffer writeShort(short value);
300 
301     /**
302      * Set the given short value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
303      * The value is written using a two's complement 16-bit encoding,
304      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
305      *
306      * @param woff The write offset, an absolute offset into this buffer to write to.
307      * @param value The short value to write.
308      * @return This Buffer.
309      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
310      *                                   greater than {@link Buffer#capacity()} minus {@link Short#BYTES}.
311      */
312     Buffer setShort(int woff, short value);
313 
314     /**
315      * Write the given unsigned short value at the current {@link Buffer#writerOffset()},
316      * and increase the writer offset by {@link Short#BYTES}.
317      * The value is written using an unsigned two's complement 16-bit encoding,
318      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
319      *
320      * @param value The int value to write.
321      * @return This Buffer.
322      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Short#BYTES},
323      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
324      */
325     Buffer writeUnsignedShort(int value);
326 
327     /**
328      * Set the given unsigned short value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
329      * The value is written using an unsigned two's complement 16-bit encoding,
330      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
331      *
332      * @param woff The write offset, an absolute offset into this buffer to write to.
333      * @param value The int value to write.
334      * @return This Buffer.
335      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
336      *                                   greater than {@link Buffer#capacity()} minus {@link Short#BYTES}.
337      */
338     Buffer setUnsignedShort(int woff, int value);
339 
340     /**
341      * Read the int value at the current {@link Buffer#readerOffset()},
342      * and increases the reader offset by 3.
343      * The value is read using a two's complement 24-bit encoding,
344      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
345      *
346      * @return The int value at the current reader offset.
347      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than 3.
348      */
349     int readMedium();
350 
351     /**
352      * Get the int value at the given reader offset.
353      * The {@link Buffer#readerOffset()} is not modified.
354      * The value is read using a two's complement 24-bit encoding,
355      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
356      *
357      * @param roff The read offset, an absolute offset into this buffer, to read from.
358      * @return The int value at the given offset.
359      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
360      *                                   greater than {@link Buffer#capacity()} minus 3.
361      */
362     int getMedium(int roff);
363 
364     /**
365      * Read the unsigned int value at the current {@link Buffer#readerOffset()},
366      * and increases the reader offset by 3.
367      * The value is read using an unsigned two's complement 24-bit encoding,
368      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
369      *
370      * @return The unsigned int value at the current reader offset.
371      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than 3.
372      */
373     int readUnsignedMedium();
374 
375     /**
376      * Get the unsigned int value at the given reader offset.
377      * The {@link Buffer#readerOffset()} is not modified.
378      * The value is read using an unsigned two's complement 24-bit encoding,
379      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
380      *
381      * @param roff The read offset, an absolute offset into this buffer, to read from.
382      * @return The unsigned int value at the given offset.
383      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
384      *                                   greater than {@link Buffer#capacity()} minus 3.
385      */
386     int getUnsignedMedium(int roff);
387 
388     /**
389      * Write the given int value at the current {@link Buffer#writerOffset()},
390      * and increase the writer offset by 3.
391      * The value is written using a two's complement 24-bit encoding,
392      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
393      *
394      * @param value The int value to write.
395      * @return This Buffer.
396      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than 3,
397      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
398      */
399     Buffer writeMedium(int value);
400 
401     /**
402      * Set the given int value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
403      * The value is written using a two's complement 24-bit encoding,
404      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
405      *
406      * @param woff The write offset, an absolute offset into this buffer to write to.
407      * @param value The int value to write.
408      * @return This Buffer.
409      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
410      *                                   greater than {@link Buffer#capacity()} minus 3.
411      */
412     Buffer setMedium(int woff, int value);
413 
414     /**
415      * Write the given unsigned int value at the current {@link Buffer#writerOffset()},
416      * and increase the writer offset by 3.
417      * The value is written using an unsigned two's complement 24-bit encoding,
418      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
419      *
420      * @param value The int value to write.
421      * @return This Buffer.
422      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than 3,
423      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
424      */
425     Buffer writeUnsignedMedium(int value);
426 
427     /**
428      * Set the given unsigned int value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
429      * The value is written using an unsigned two's complement 24-bit encoding,
430      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
431      *
432      * @param woff The write offset, an absolute offset into this buffer to write to.
433      * @param value The int value to write.
434      * @return This Buffer.
435      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
436      *                                   greater than {@link Buffer#capacity()} minus 3.
437      */
438     Buffer setUnsignedMedium(int woff, int value);
439 
440     /**
441      * Read the int value at the current {@link Buffer#readerOffset()},
442      * and increases the reader offset by {@link Integer#BYTES}.
443      * The value is read using a two's complement 32-bit encoding,
444      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
445      *
446      * @return The int value at the current reader offset.
447      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Integer#BYTES}.
448      */
449     int readInt();
450 
451     /**
452      * Get the int value at the given reader offset.
453      * The {@link Buffer#readerOffset()} is not modified.
454      * The value is read using a two's complement 32-bit encoding,
455      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
456      *
457      * @param roff The read offset, an absolute offset into this buffer, to read from.
458      * @return The int value at the given offset.
459      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
460      *                                   greater than {@link Buffer#capacity()} minus {@link Integer#BYTES}.
461      */
462     int getInt(int roff);
463 
464     /**
465      * Read the unsigned int value at the current {@link Buffer#readerOffset()},
466      * and increases the reader offset by {@link Integer#BYTES}.
467      * The value is read using an unsigned two's complement 32-bit encoding,
468      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
469      *
470      * @return The unsigned int value at the current reader offset.
471      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Integer#BYTES}.
472      */
473     long readUnsignedInt();
474 
475     /**
476      * Get the unsigned int value at the given reader offset.
477      * The {@link Buffer#readerOffset()} is not modified.
478      * The value is read using an unsigned two's complement 32-bit encoding,
479      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
480      *
481      * @param roff The read offset, an absolute offset into this buffer, to read from.
482      * @return The unsigned int value at the given offset.
483      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
484      *                                   greater than {@link Buffer#capacity()} minus {@link Integer#BYTES}.
485      */
486     long getUnsignedInt(int roff);
487 
488     /**
489      * Write the given int value at the current {@link Buffer#writerOffset()},
490      * and increase the writer offset by {@link Integer#BYTES}.
491      * The value is written using a two's complement 32-bit encoding,
492      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
493      *
494      * @param value The int value to write.
495      * @return This Buffer.
496      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Integer#BYTES},
497      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
498      */
499     Buffer writeInt(int value);
500 
501     /**
502      * Set the given int value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
503      * The value is written using a two's complement 32-bit encoding,
504      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
505      *
506      * @param woff The write offset, an absolute offset into this buffer to write to.
507      * @param value The int value to write.
508      * @return This Buffer.
509      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
510      *                                   greater than {@link Buffer#capacity()} minus {@link Integer#BYTES}.
511      */
512     Buffer setInt(int woff, int value);
513 
514     /**
515      * Write the given unsigned int value at the current {@link Buffer#writerOffset()},
516      * and increase the writer offset by {@link Integer#BYTES}.
517      * The value is written using an unsigned two's complement 32-bit encoding,
518      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
519      *
520      * @param value The long value to write.
521      * @return This Buffer.
522      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Integer#BYTES},
523      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
524      */
525     Buffer writeUnsignedInt(long value);
526 
527     /**
528      * Set the given unsigned int value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
529      * The value is written using an unsigned two's complement 32-bit encoding,
530      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
531      *
532      * @param woff The write offset, an absolute offset into this buffer to write to.
533      * @param value The long value to write.
534      * @return This Buffer.
535      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
536      *                                   greater than {@link Buffer#capacity()} minus {@link Integer#BYTES}.
537      */
538     Buffer setUnsignedInt(int woff, long value);
539 
540     /**
541      * Read the float value at the current {@link Buffer#readerOffset()},
542      * and increases the reader offset by {@link Float#BYTES}.
543      * The value is read using a 32-bit IEEE floating point encoding,
544      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
545      *
546      * @return The float value at the current reader offset.
547      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Float#BYTES}.
548      */
549     float readFloat();
550 
551     /**
552      * Get the float value at the given reader offset.
553      * The {@link Buffer#readerOffset()} is not modified.
554      * The value is read using a 32-bit IEEE floating point encoding,
555      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
556      *
557      * @param roff The read offset, an absolute offset into this buffer, to read from.
558      * @return The float value at the given offset.
559      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
560      *                                   greater than {@link Buffer#capacity()} minus {@link Float#BYTES}.
561      */
562     float getFloat(int roff);
563 
564     /**
565      * Write the given float value at the current {@link Buffer#writerOffset()},
566      * and increase the writer offset by {@link Float#BYTES}.
567      * The value is written using a 32-bit IEEE floating point encoding,
568      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
569      *
570      * @param value The float value to write.
571      * @return This Buffer.
572      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Float#BYTES},
573      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
574      */
575     Buffer writeFloat(float value);
576 
577     /**
578      * Set the given float value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
579      * The value is written using a 32-bit IEEE floating point encoding,
580      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
581      *
582      * @param woff The write offset, an absolute offset into this buffer to write to.
583      * @param value The float value to write.
584      * @return This Buffer.
585      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
586      *                                   greater than {@link Buffer#capacity()} minus {@link Float#BYTES}.
587      */
588     Buffer setFloat(int woff, float value);
589 
590     /**
591      * Read the long value at the current {@link Buffer#readerOffset()},
592      * and increases the reader offset by {@link Long#BYTES}.
593      * The value is read using a two's complement 64-bit encoding,
594      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
595      *
596      * @return The long value at the current reader offset.
597      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Long#BYTES}.
598      */
599     long readLong();
600 
601     /**
602      * Get the long value at the given reader offset.
603      * The {@link Buffer#readerOffset()} is not modified.
604      * The value is read using a two's complement 64-bit encoding,
605      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
606      *
607      * @param roff The read offset, an absolute offset into this buffer, to read from.
608      * @return The long value at the given offset.
609      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
610      *                                   greater than {@link Buffer#capacity()} minus {@link Long#BYTES}.
611      */
612     long getLong(int roff);
613 
614     /**
615      * Write the given long value at the current {@link Buffer#writerOffset()},
616      * and increase the writer offset by {@link Long#BYTES}.
617      * The value is written using a two's complement 64-bit encoding,
618      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
619      *
620      * @param value The long value to write.
621      * @return This Buffer.
622      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Long#BYTES},
623      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
624      */
625     Buffer writeLong(long value);
626 
627     /**
628      * Set the given long value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
629      * The value is written using a two's complement 64-bit encoding,
630      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
631      *
632      * @param woff The write offset, an absolute offset into this buffer to write to.
633      * @param value The long value to write.
634      * @return This Buffer.
635      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
636      *                                   greater than {@link Buffer#capacity()} minus {@link Long#BYTES}.
637      */
638     Buffer setLong(int woff, long value);
639 
640     /**
641      * Read the double value at the current {@link Buffer#readerOffset()},
642      * and increases the reader offset by {@link Double#BYTES}.
643      * The value is read using a 64-bit IEEE floating point encoding,
644      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
645      *
646      * @return The double value at the current reader offset.
647      * @throws IndexOutOfBoundsException If {@link Buffer#readableBytes} is less than {@link Double#BYTES}.
648      */
649     double readDouble();
650 
651     /**
652      * Get the double value at the given reader offset.
653      * The {@link Buffer#readerOffset()} is not modified.
654      * The value is read using a 64-bit IEEE floating point encoding,
655      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
656      *
657      * @param roff The read offset, an absolute offset into this buffer, to read from.
658      * @return The double value at the given offset.
659      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
660      *                                   greater than {@link Buffer#capacity()} minus {@link Double#BYTES}.
661      */
662     double getDouble(int roff);
663 
664     /**
665      * Write the given double value at the current {@link Buffer#writerOffset()},
666      * and increase the writer offset by {@link Double#BYTES}.
667      * The value is written using a 64-bit IEEE floating point encoding,
668      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
669      *
670      * @param value The double value to write.
671      * @return This Buffer.
672      * @throws IndexOutOfBoundsException If {@link Buffer#writableBytes} is less than {@link Double#BYTES},
673      * and the {@linkplain Buffer#capacity() buffer capacity} cannot be automatically increased.
674      */
675     Buffer writeDouble(double value);
676 
677     /**
678      * Set the given double value at the given write offset. The {@link Buffer#writerOffset()} is not modified.
679      * The value is written using a 64-bit IEEE floating point encoding,
680      * in {@link java.nio.ByteOrder#BIG_ENDIAN} byte order.
681      *
682      * @param woff The write offset, an absolute offset into this buffer to write to.
683      * @param value The double value to write.
684      * @return This Buffer.
685      * @throws IndexOutOfBoundsException if the given offset is out of bounds of the buffer, that is, less than 0 or
686      *                                   greater than {@link Buffer#capacity()} minus {@link Double#BYTES}.
687      */
688     Buffer setDouble(int woff, double value);
689     // </editor-fold>
690 }