code: public Resource write(@NonNull Resource resource) throws IOException {
        Resource stringResource = new StringResource();
        try (PrintStream printStream = new PrintStream(stringResource.outputStream())) {
           print(printStream);
        }
        resource.write(stringResource.readToString());
        return resource;
     }
docs: Writes the table to a resource.
  
  @param resource the resource to write to
  @return the resource written to
  @throws IOException Something went wrong writing to the resource