Code example for JsonReader

Methods: peek

0
    newFactory(StringBuilder.class, STRING_BUILDER);
 
  public static final TypeAdapter<StringBuffer> STRING_BUFFER = new TypeAdapter<StringBuffer>() {
    @Override 
    public StringBuffer read(JsonReader in) throws IOException { 
      if (in.peek() == JsonToken.NULL) { 
        in.nextNull(); 
        return null; 
      } 
      return new StringBuffer(in.nextString()); 
    } 
    @Override 
    public void write(JsonWriter out, StringBuffer value) throws IOException { 
      out.value(value == null ? null : value.toString()); 
    } 
  }; 
 
  public static final TypeAdapterFactory STRING_BUFFER_FACTORY =
    newFactory(StringBuffer.class, STRING_BUFFER);
 
Connect your IDE to all the code out there  Get Codota for Java