Add Netty ByteBuf extensions #11

Closed
opened 5 years ago by gpe · 1 comments
gpe commented 5 years ago
Owner

I think we need three classes: a class with extra static methods for ByteBuf and a BitBuf class, usable like so:

try (var bitBuf = new BitBuf(buf)) {
    bitBuf.putBits(8, 123);
    // ...
}

The close() method should automatically align the reader/writerIndex to the next byte, flushing the last byte to the underlying ByteBuf if it is a writer.

I don't think it's worth automatically generating the ByteBuf extension class: although there are lots of theoretical combinations for the add/sub/complement methods, few of them are actually present in the client's buffer class. We should just base our selection of methods on the methods present in the client.

I think we need three classes: a class with extra static methods for `ByteBuf` and a `BitBuf` class, usable like so: ```java try (var bitBuf = new BitBuf(buf)) { bitBuf.putBits(8, 123); // ... } ``` The `close()` method should automatically align the reader/writerIndex to the next byte, flushing the last byte to the underlying `ByteBuf` if it is a writer. I don't think it's worth automatically generating the `ByteBuf` extension class: although there are lots of theoretical combinations for the add/sub/complement methods, few of them are actually present in the client's buffer class. We should just base our selection of methods on the methods present in the client.
gpe added the
feature
label 4 years ago
gpe added the
buffer
label 4 years ago
Poster
Owner

Pretty much done now.

Pretty much done now.
gpe closed this issue 3 years ago
Sign in to join this conversation.
Loading…
There is no content yet.