class DefaultHttp2LocalFlowController implements Http2LocalFlowController {

  @Override
  public boolean consumeBytes(final Http2Stream stream, final int numBytes) throws Http2Exception {
    assert ctx != null && ctx.executor().inEventLoop();
    checkPositiveOrZero(numBytes, "numBytes");
    if (numBytes == 0) {
      return false;
    }

    // Streams automatically consume all remaining bytes when they are closed, so just ignore
    // if already closed.
    if (stream != null && !isClosed(stream)) {
      if (stream.id() == Http2CodecUtil.CONNECTION_STREAM_ID) {
        throw new UnsupportedOperationException(
            "Returning bytes for the connection window is not supported");
      }

      boolean windowUpdateSent = connectionState().consumeBytes(numBytes);
      windowUpdateSent |= state(stream).consumeBytes(numBytes);
      return windowUpdateSent;
    }
    return false;
  }

  public  DefaultHttp2LocalFlowController(final Http2Connection connection);
  public  DefaultHttp2LocalFlowController(
      final Http2Connection connection,
      final float windowUpdateRatio,
      final boolean autoRefillConnectionWindow);

}