private static void writeResponse()

in tooling/utils/intellij-broadcast-core/src/main/java/com/uber/debug/broadcast/core/DebugBroadcastRequest.java [135:152]


  private static void writeResponse(
      int sequence, Object payload, @Nullable String errorDescription) {
    String tag = getTag(sequence);
    DebugBroadcastResponse result = new DebugBroadcastResponse(payload);
    if (errorDescription != null) {
      result.setErrorDescription(errorDescription);
    }
    String response = GSON.toJson(result);
    int partNumber = 0;
    int partCount = (response.length() / LOGCAT_MAX_LENGTH) + 1;
    while (partNumber++ <= partCount) {
      int leftover = Math.min(response.length(), LOGCAT_MAX_LENGTH);
      String part = response.substring(0, leftover);
      response = response.substring(leftover);
      String prefix = String.format(Locale.US, "%d/%d", partNumber, partCount);
      Log.d(tag, prefix + " " + part);
    }
  }