code: public static ByteBuf readBytes(ByteBufAllocator alloc, ByteBuf buffer, int length) {
          boolean release = true;
          ByteBuf dst = alloc.buffer(length);
          try {
              buffer.readBytes(dst);
              release = false;
              return dst;
          } finally {
              if (release) {
                  dst.release();
              }
          }
      }
docs: Read the given amount of bytes into a new {@link ByteBuf} that is allocated from the {@link ByteBufAllocator}.