Package com.google.gson.stream

Examples of com.google.gson.stream.JsonReader.beginArray()


    Gson gson = new GsonBuilder()
      .registerTypeAdapter(byte[].class, new JsonByteArrayAdapter())
      .create();
   
    while (true) {
      reader.beginArray();
      EventType type = EventType.valueOf(reader.nextString());
      IStreamEvent evt;
      switch (type) {
        case APPEND_STDERR:
        case APPEND_STDOUT:
View Full Code Here


        return;
      }

      // The response is an array of stream event object
      JsonReader jsonReader = new JsonReader(new InputStreamReader(urlConn.getInputStream(), Charsets.UTF_8));
      jsonReader.beginArray();
      while (jsonReader.peek() != JsonToken.END_ARRAY) {
        Boolean result = callback.apply(GSON.<StreamEvent>fromJson(jsonReader, StreamEvent.class));
        if (result == null || !result) {
          break;
        }
View Full Code Here

        JsonReader jsonReader;

        try
        {
            jsonReader = new JsonReader(new FileReader(jsonFile));
            jsonReader.beginArray();
            while (jsonReader.hasNext())
            {
                EnergyValueStackMapping energyValueStackMapping = jsonSerializer.fromJson(jsonReader, EnergyValueStackMapping.class);
                energyValueStackMap.put(energyValueStackMapping.wrappedStack, energyValueStackMapping.energyValue);
            }
View Full Code Here

  private void loadConcreteTypeMap() throws IOException {
    if (baseTypeArrayFile != null) {
      JsonReader reader = new JsonReader(new InputStreamReader(new FileInputStream(
          baseTypeArrayFile), UTF8));
      reader.setLenient(true);
      reader.beginArray();
      while (reader.hasNext()) {
        baseTypes.add(reader.nextString());
      }
      reader.endArray();
      reader.close();
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.