What about the case where part1.capacity=100, part2.capacity=200 and
capacity(100) is called. This would set part2 to null. Should this even be
allowed then? What if then capacity(150) is called: Should part2 be
populated again?

Gesendet von Windows Mail


On Sat, Apr 12, 2014 at 9:37 PM, Norman Maurer <notifications@github.com>wrote:

> In buffer/src/main/java/io/netty/buffer/BipartiteByteBuf.java:
>
> > +
> > +    public BipartiteByteBuf(ByteBufAllocator alloc, boolean directByDefault, ByteBuf part1, ByteBuf part2) {
> > +        super(Integer.MAX_VALUE);
> > +
> > +        if (alloc == null) {
> > +            throw new NullPointerException("alloc");
> > +        }
> > +
> > +        this.alloc = alloc;
> > +        this.directByDefault = directByDefault;
> > +        leak = leakDetector.open(this);
> > +        part1(part1);
> > +        part2(part2);
> > +    }
> > +
> > +    public BipartiteByteBuf part1(ByteBuf buffer) {
>
> I think I would just set the maxCapacity in the constructor and not allow
> to change it
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/netty/netty/pull/2382/files#r11561231>
> .
>