private int nextType(int expectedType) {
        int type = nextType();
        if (type == expectedType || type == TYPE_NULL)
            return type;

        throw new ConversionException("Expected a " + classForHandle(expectedType) + " but value is a "
                + classForHandle(type));
    }