docs: @Override
    public void compose(OutputStream stream, Resource resource) throws IOException {
      OutputStreamWriter osw = new OutputStreamWriter(stream, "UTF-8");
      if (style == OutputStyle.CANONICAL)
        json = new JsonCreatorCanonical(osw);
      else
        json = new JsonCreatorDirect(osw); // use this instead of Gson because this preserves decimal formatting
      json.setIndent(style == OutputStyle.PRETTY ? "  " : "");
      json.beginObject();
      composeResource(resource);
      json.endObject();
      json.finish();
      osw.flush();
    }