Example usage for com.google.gson.stream JsonReader nextNull

List of usage examples for com.google.gson.stream JsonReader nextNull

Introduction

In this page you can find the example usage for com.google.gson.stream JsonReader nextNull.

Prototype

public void nextNull() throws IOException 

Source Link

Document

Consumes the next token from the JSON stream and asserts that it is a literal null.

Usage

From source file:yagw2api.server.character.LocalDateTimeGSONAdapter.java

License:Apache License

@Override
public LocalDateTime read(final JsonReader reader) throws IOException {
    if (reader.peek() == JsonToken.NULL) {
        reader.nextNull();
        return null;
    } else {//from  w  ww .  j av a 2  s.  c  o m
        return LocalDateTime.ofEpochSecond(reader.nextLong(), 0, ZoneOffset.UTC);
    }
}