Package com.google.api.client.json

Examples of com.google.api.client.json.JsonGenerator


  }

  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;
  }
View Full Code Here


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

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

    super(jsonFactory, data);
  }

  @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();
  }
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

Related Classes of com.google.api.client.json.JsonGenerator

Copyright © 2018 www.massapicom. 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.