@Override
  public JsonToken peek() throws IOException {
    switch (state()) {
    case INITIAL:
    case SCOPE_DOCUMENT:
    case TYPE:
      advance();
      return peek();
    case NAME:
      return JsonToken.NAME;
    case END_OF_DOCUMENT:
      return JsonToken.END_OBJECT;
    case END_OF_ARRAY:
      return JsonToken.END_ARRAY;
    case DONE:
      return JsonToken.END_DOCUMENT;
    case VALUE:
      return toGsonToken(delegate.getCurrentBsonType());
    default:
      throw new IllegalStateException("Unexpected state: " + state() + " currentType:" +
          delegate.getCurrentBsonType());
    }
  }
In order to be able to get current location of the BSON "cursor" (document or array start/end)
enforcing clients to
provide {@link AbstractBsonReader} which exposes this information via {@code getState()}
method, instead of more generic interface {@link BsonReader}.
@param delegate
@see AbstractBsonReader#getState()
mongo/src/org/immutables/mongo/bson4gson/BsonReader.java