@@ -234,7 +234,7 @@ public void wrap(final int streamId, final FrameType type, final ByteBuffer data
234
234
POOL .release (this .directBuffer );
235
235
236
236
this .directBuffer =
237
- POOL .acquireMutableDirectBuffer (FrameHeaderFlyweight .computeFrameHeaderLength (type , 0 , data .capacity ()));
237
+ POOL .acquireMutableDirectBuffer (FrameHeaderFlyweight .computeFrameHeaderLength (type , 0 , data .remaining ()));
238
238
239
239
this .length = FrameHeaderFlyweight .encode (this .directBuffer , offset , streamId , 0 , type , NULL_BYTEBUFFER , data );
240
240
}
@@ -261,7 +261,7 @@ public static Frame from(
261
261
final ByteBuffer data = payload .getData ();
262
262
263
263
final Frame frame =
264
- POOL .acquireFrame (SetupFrameFlyweight .computeFrameLength (metadataMimeType , dataMimeType , metadata .capacity (), data .capacity ()));
264
+ POOL .acquireFrame (SetupFrameFlyweight .computeFrameLength (metadataMimeType , dataMimeType , metadata .remaining (), data .remaining ()));
265
265
266
266
frame .length = SetupFrameFlyweight .encode (
267
267
frame .directBuffer , frame .offset , flags , keepaliveInterval , maxLifetime , metadataMimeType , dataMimeType , metadata , data );
@@ -317,7 +317,7 @@ public static Frame from(
317
317
) {
318
318
final int code = ErrorFrameFlyweight .errorCodeFromException (throwable );
319
319
final Frame frame = POOL .acquireFrame (
320
- ErrorFrameFlyweight .computeFrameLength (metadata .capacity (), data .capacity ()));
320
+ ErrorFrameFlyweight .computeFrameLength (metadata .remaining (), data .remaining ()));
321
321
322
322
frame .length = ErrorFrameFlyweight .encode (
323
323
frame .directBuffer , frame .offset , streamId , code , metadata , data );
@@ -354,7 +354,7 @@ public static class Lease
354
354
{
355
355
public static Frame from (int ttl , int numberOfRequests , ByteBuffer metadata )
356
356
{
357
- final Frame frame = POOL .acquireFrame (LeaseFrameFlyweight .computeFrameLength (metadata .capacity ()));
357
+ final Frame frame = POOL .acquireFrame (LeaseFrameFlyweight .computeFrameLength (metadata .remaining ()));
358
358
359
359
frame .length = LeaseFrameFlyweight .encode (frame .directBuffer , frame .offset , ttl , numberOfRequests , metadata );
360
360
return frame ;
@@ -397,7 +397,7 @@ public static Frame from(int streamId, FrameType type, Payload payload, int init
397
397
final ByteBuffer d = payload .getData () != null ? payload .getData () : NULL_BYTEBUFFER ;
398
398
final ByteBuffer md = payload .getMetadata () != null ? payload .getMetadata () : NULL_BYTEBUFFER ;
399
399
400
- final Frame frame = POOL .acquireFrame (RequestFrameFlyweight .computeFrameLength (type , md .capacity (), d .capacity ()));
400
+ final Frame frame = POOL .acquireFrame (RequestFrameFlyweight .computeFrameLength (type , md .remaining (), d .remaining ()));
401
401
402
402
if (type .hasInitialRequestN ())
403
403
{
@@ -421,7 +421,7 @@ public static Frame from(int streamId, FrameType type, int flags)
421
421
422
422
public static Frame from (int streamId , FrameType type , ByteBuffer metadata , ByteBuffer data , int initialRequestN , int flags )
423
423
{
424
- final Frame frame = POOL .acquireFrame (RequestFrameFlyweight .computeFrameLength (type , metadata .capacity (), data .capacity ()));
424
+ final Frame frame = POOL .acquireFrame (RequestFrameFlyweight .computeFrameLength (type , metadata .remaining (), data .remaining ()));
425
425
426
426
frame .length = RequestFrameFlyweight .encode (frame .directBuffer , frame .offset , streamId , flags , type , initialRequestN , metadata , data );
427
427
return frame ;
@@ -471,7 +471,7 @@ public static Frame from(int streamId, FrameType type, Payload payload)
471
471
final ByteBuffer metadata = payload .getMetadata () != null ? payload .getMetadata () : NULL_BYTEBUFFER ;
472
472
473
473
final Frame frame =
474
- POOL .acquireFrame (FrameHeaderFlyweight .computeFrameHeaderLength (type , metadata .capacity (), data .capacity ()));
474
+ POOL .acquireFrame (FrameHeaderFlyweight .computeFrameHeaderLength (type , metadata .remaining (), data .remaining ()));
475
475
476
476
frame .length = FrameHeaderFlyweight .encode (frame .directBuffer , frame .offset , streamId , 0 , type , metadata , data );
477
477
return frame ;
@@ -480,7 +480,7 @@ public static Frame from(int streamId, FrameType type, Payload payload)
480
480
public static Frame from (int streamId , FrameType type , ByteBuffer metadata , ByteBuffer data , int flags )
481
481
{
482
482
final Frame frame =
483
- POOL .acquireFrame (FrameHeaderFlyweight .computeFrameHeaderLength (type , metadata .capacity (), data .capacity ()));
483
+ POOL .acquireFrame (FrameHeaderFlyweight .computeFrameHeaderLength (type , metadata .remaining (), data .remaining ()));
484
484
485
485
frame .length = FrameHeaderFlyweight .encode (frame .directBuffer , frame .offset , streamId , flags , type , metadata , data );
486
486
return frame ;
@@ -515,7 +515,7 @@ public static class Keepalive
515
515
public static Frame from (ByteBuffer data , boolean respond )
516
516
{
517
517
final Frame frame =
518
- POOL .acquireFrame (FrameHeaderFlyweight .computeFrameHeaderLength (FrameType .KEEPALIVE , 0 , data .capacity ()));
518
+ POOL .acquireFrame (FrameHeaderFlyweight .computeFrameHeaderLength (FrameType .KEEPALIVE , 0 , data .remaining ()));
519
519
520
520
final int flags = (respond ? FrameHeaderFlyweight .FLAGS_KEEPALIVE_R : 0 );
521
521
0 commit comments