Package com.google.api.client.json

Examples of com.google.api.client.json.JsonGenerator.serialize()


  private File createTempFile() throws Exception {
    File result = File.createTempFile("credentials", null);
    result.deleteOnExit();
    JsonGenerator generator =
        JSON_FACTORY.createJsonGenerator(new FileOutputStream(result), Charsets.UTF_8);
    generator.serialize(new FilePersistedCredentials());
    generator.close();
    return result;
  }

  public void testMigrateTo() throws Exception {
View Full Code Here


    this.data = Preconditions.checkNotNull(data);
  }

  public void writeTo(OutputStream out) throws IOException {
    JsonGenerator generator = jsonFactory.createJsonGenerator(out, getCharset());
    generator.serialize(data);
    generator.flush();
  }

  /**
   * Sets the content type or {@code null} for none.
View Full Code Here

  @Override
  public void writeTo(OutputStream out) throws IOException {
    JsonGenerator generator = getJsonFactory().createJsonGenerator(out, getCharset());
    generator.writeStartObject();
    generator.writeFieldName("data");
    generator.serialize(getData());
    generator.writeEndObject();
    generator.flush();
  }

  @Override
View Full Code Here

  private void storeClientToken(final JsonFactory jsonFactory) throws IOException {

    final StringWriter jsonTrWriter = new StringWriter();
    final JsonGenerator generator = jsonFactory.createJsonGenerator(jsonTrWriter);
    generator.serialize(clientToken);
    generator.flush();
    generator.close();

    FileUtils.writeStringToFile(clientTokenPath.toFile(), jsonTrWriter.toString());
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.