• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JSONObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中twitter4j.internal.org.json.JSONObject的典型用法代码示例。如果您正苦于以下问题:Java JSONObject类的具体用法?Java JSONObject怎么用?Java JSONObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JSONObject类属于twitter4j.internal.org.json包,在下文中一共展示了JSONObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    try {
        JSONArray indicesArray = json.getJSONArray("indices");
        setStart(indicesArray.getInt(0));
        setEnd(indicesArray.getInt(1));

        if (!json.isNull("name")) {
            this.name = json.getString("name");
        }
        if (!json.isNull("screen_name")) {
            this.screenName = json.getString("screen_name");
        }
        id = z_T4JInternalParseUtil.getLong("id", json);
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:18,代码来源:UserMentionEntityJSONImpl.java


示例2: createRateLimitStatuses

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
static Map<String, RateLimitStatus> createRateLimitStatuses(JSONObject json) throws TwitterException {
    Map<String, RateLimitStatus> map = new HashMap<String, RateLimitStatus>();
    try {
        JSONObject resources = json.getJSONObject("resources");
        Iterator resourceKeys = resources.keys();
        while (resourceKeys.hasNext()) {
            JSONObject resource = resources.getJSONObject((String) resourceKeys.next());
            Iterator endpointKeys = resource.keys();
            while (endpointKeys.hasNext()) {
                String endpoint = (String) endpointKeys.next();
                JSONObject rateLimitStatusJSON = resource.getJSONObject(endpoint);
                RateLimitStatus rateLimitStatus = new RateLimitStatusJSONImpl(rateLimitStatusJSON);
                map.put(endpoint, rateLimitStatus);
            }
        }
        return Collections.unmodifiableMap(map);
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:21,代码来源:RateLimitStatusJSONImpl.java


示例3: getURLEntitiesFromJSON

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
/**
 * Get URL Entities from JSON Object.
 * returns URLEntity array by entities/[category]/urls/url[]
 *
 * @param json     user json object
 * @param category entities category. e.g. "description" or "url"
 * @return URLEntity array by entities/[category]/urls/url[]
 * @throws JSONException
 * @throws TwitterException
 */
private static URLEntity[] getURLEntitiesFromJSON(JSONObject json, String category) throws JSONException, TwitterException {
    if (!json.isNull("entities")) {
        JSONObject entitiesJSON = json.getJSONObject("entities");
        if (!entitiesJSON.isNull(category)) {
            JSONObject descriptionEntitiesJSON = entitiesJSON.getJSONObject(category);
            if (!descriptionEntitiesJSON.isNull("urls")) {
                JSONArray urlsArray = descriptionEntitiesJSON.getJSONArray("urls");
                int len = urlsArray.length();
                URLEntity[] urlEntities = new URLEntity[len];
                for (int i = 0; i < len; i++) {
                    urlEntities[i] = new URLEntityJSONImpl(urlsArray.getJSONObject(i));
                }
                return urlEntities;
            }
        }
    }
    return null;
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:29,代码来源:UserJSONImpl.java


示例4: createUserList

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
static ResponseList<User> createUserList(JSONArray list, HttpResponse res, Configuration conf) throws TwitterException {
    try {
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.clearThreadLocalMap();
        }
        int size = list.length();
        ResponseList<User> users = new ResponseListImpl<User>(size, res);
        for (int i = 0; i < size; i++) {
            JSONObject json = list.getJSONObject(i);
            User user = new UserJSONImpl(json);
            users.add(user);
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.registerJSONObject(user, json);
            }
        }
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.registerJSONObject(users, list);
        }
        return users;
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    } catch (TwitterException te) {
        throw te;
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:26,代码来源:UserJSONImpl.java


示例5: createDirectMessageList

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
static ResponseList<DirectMessage> createDirectMessageList(HttpResponse res, Configuration conf) throws TwitterException {
    try {
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.clearThreadLocalMap();
        }
        JSONArray list = res.asJSONArray();
        int size = list.length();
        ResponseList<DirectMessage> directMessages = new ResponseListImpl<DirectMessage>(size, res);
        for (int i = 0; i < size; i++) {
            JSONObject json = list.getJSONObject(i);
            DirectMessage directMessage = new DirectMessageJSONImpl(json);
            directMessages.add(directMessage);
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.registerJSONObject(directMessage, json);
            }
        }
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.registerJSONObject(directMessages, list);
        }
        return directMessages;
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    } catch (TwitterException te) {
        throw te;
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:27,代码来源:DirectMessageJSONImpl.java


示例6: AccountSettingsJSONImpl

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
private AccountSettingsJSONImpl(HttpResponse res, JSONObject json) throws TwitterException {
    super(res);
    try {
        JSONObject sleepTime = json.getJSONObject("sleep_time");
        SLEEP_TIME_ENABLED = getBoolean("enabled", sleepTime);
        SLEEP_START_TIME = sleepTime.getString("start_time");
        SLEEP_END_TIME = sleepTime.getString("end_time");
        if (json.isNull("trend_location")) {
            TREND_LOCATION = new Location[0];
        } else {
            JSONArray locations = json.getJSONArray("trend_location");
            TREND_LOCATION = new Location[locations.length()];
            for (int i = 0; i < locations.length(); i++) {
                TREND_LOCATION[i] = new LocationJSONImpl(locations.getJSONObject(i));
            }
        }
        GEO_ENABLED = getBoolean("geo_enabled", json);
        LANGUAGE = json.getString("language");
        ALWAYS_USE_HTTPS = getBoolean("always_use_https", json);
        DISCOVERABLE_BY_EMAIL = getBoolean("discoverable_by_email", json);
        TIMEZONE = new TimeZoneJSONImpl(json.getJSONObject("time_zone"));
    } catch (JSONException e) {
        throw new TwitterException(e);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:26,代码来源:AccountSettingsJSONImpl.java


示例7: init

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    try {
        JSONArray indicesArray = json.getJSONArray("indices");
        setStart(indicesArray.getInt(0));
        setEnd(indicesArray.getInt(1));

        this.url = json.getString("url");
        if (!json.isNull("expanded_url")) {
            // sets expandedURL to url if expanded_url is null
            // http://jira.twitter4j.org/browse/TFJ-704
            this.expandedURL = json.getString("expanded_url");
        }else{
            this.expandedURL = url;
        }

        if (!json.isNull("display_url")) {
            // sets displayURL to url if expanded_url is null
            // http://jira.twitter4j.org/browse/TFJ-704
            this.displayURL = json.getString("display_url");
        }else{
            this.displayURL = url;
        }
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:27,代码来源:URLEntityJSONImpl.java


示例8: createStatusList

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
public static ResponseList<Status> createStatusList(HttpResponse res, Configuration conf) throws TwitterException {
    try {
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.clearThreadLocalMap();
        }
        JSONArray list = res.asJSONArray();
        int size = list.length();
        ResponseList<Status> statuses = new ResponseListImpl<Status>(size, res);
        for (int i = 0; i < size; i++) {
            JSONObject json = list.getJSONObject(i);
            Status status = new StatusJSONImpl(json);
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.registerJSONObject(status, json);
            }
            statuses.add(status);
        }
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.registerJSONObject(statuses, list);
        }
        return statuses;
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:25,代码来源:StatusJSONImpl.java


示例9: parseStatuses

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
public static ResponseList<Status> parseStatuses(Configuration conf, JSONArray list) throws JSONException, TwitterException {
    if (conf.isJSONStoreEnabled()) {
        DataObjectFactoryUtil.clearThreadLocalMap();
    }
    int size = list.length();
    ResponseList<Status> statuses = new ResponseListImpl<Status>(size, null);
    for (int i = 0; i < size; i++) {
        JSONObject json = list.getJSONObject(i);
        Status status = new StatusJSONImpl(json);
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.registerJSONObject(status, json);
        }
        statuses.add(status);
    }
    if (conf.isJSONStoreEnabled()) {
        DataObjectFactoryUtil.registerJSONObject(statuses, list);
    }
    return statuses;
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:20,代码来源:StatusJSONImpl.java


示例10: init

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    id = getLong("id", json);
    idStr = getRawString("id_str", json);
    name = getRawString("name", json);
    fullName = getRawString("full_name", json);
    slug = getRawString("slug", json);
    description = getRawString("description", json);
    subscriberCount = getInt("subscriber_count", json);
    memberCount = getInt("member_count", json);
    uri = getRawString("uri", json);
    mode = "public".equals(getRawString("mode", json));
    following = getBoolean("following", json);

    try {
        if (!json.isNull("user")) {
            user = new UserJSONImpl(json.getJSONObject("user"));
        }
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:22,代码来源:UserListJSONImpl.java


示例11: createUserListList

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
static ResponseList<UserList> createUserListList(HttpResponse res, Configuration conf) throws TwitterException {
    try {
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.clearThreadLocalMap();
        }
        JSONArray list = res.asJSONArray();
        int size = list.length();
        ResponseList<UserList> users = new ResponseListImpl<UserList>(size, res);
        for (int i = 0; i < size; i++) {
            JSONObject userListJson = list.getJSONObject(i);
            UserList userList = new UserListJSONImpl(userListJson);
            users.add(userList);
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.registerJSONObject(userList, userListJson);
            }
        }
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.registerJSONObject(users, list);
        }
        return users;
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    } catch (TwitterException te) {
        throw te;
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:27,代码来源:UserListJSONImpl.java


示例12: VideoInfoImpl

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
VideoInfoImpl(JSONObject jsonObject) throws TwitterException {
    aspectRatio = new ArrayList<>();
    variants = new ArrayList<>();
    try {
        if (jsonObject.has("aspect_ratio")) {
            JSONArray aspectRationArray = jsonObject.getJSONArray("aspect_ratio");
            for (int i = 0; i < aspectRationArray.length(); i++) {
                aspectRatio.add(aspectRationArray.getInt(i));
            }
        }
        if (jsonObject.has("duration_millis")) {
            millis = jsonObject.getLong("duration_millis");
        }

        if (jsonObject.has("variants")) {
            JSONArray variantJSONArray = jsonObject.getJSONArray("variants");
            for (int i = 0; i < variantJSONArray.length(); i++) {
                variants.add(new VariantImpl(variantJSONArray.getJSONObject(i)));
            }
        }
    } catch (JSONException e) {
        throw new TwitterException(e);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:25,代码来源:MediaEntityJSONImpl.java


示例13: extractLocation

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
private static Location extractLocation(JSONObject json, boolean storeJSON) throws TwitterException {
    if (json.isNull("locations")) {
        return null;
    }
    ResponseList<Location> locations;
    try {
        locations = LocationJSONImpl.createLocationList(json.getJSONArray("locations"), storeJSON);
    } catch (JSONException e) {
        throw new AssertionError("locations can't be null");
    }
    Location location;
    if (0 != locations.size()) {
        location = locations.get(0);
    } else {
        location = null;
    }
    return location;
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:19,代码来源:TrendsJSONImpl.java


示例14: init

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    try {
        mediaId = getLong("media_id", json);
        mediaIdString = getRawString("media_id", json);
        size = getLong("size", json);
        if (!json.isNull("image")) {
            image = new TwitterImageJSONImpl(json);
        }
        if (!json.isNull("expires_after_secs")) {
            expiresAfterSecs = getLong("expires_after_secs", json);
        }
        if (!json.isNull("processing_info")) {
            JSONObject processingInfo = new JSONObject(getRawString("processing_info", json));
            if (!processingInfo.isNull("state")) {
                state = getRawString("state", processingInfo);
            }
        }
    } catch (Exception jsone) {
        throw new TwitterException(jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:22,代码来源:TwitterUploadMediaResponseImpl.java


示例15: LocationJSONImpl

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
public LocationJSONImpl(JSONObject location) throws TwitterException {
    super(location);
    try {
        woeid = getInt("woeid", location);
        countryName = getUnescapedString("country", location);
        countryCode = getRawString("countryCode", location);
        if (!location.isNull("placeType")) {
            JSONObject placeJSON = location.getJSONObject("placeType");
            placeName = getUnescapedString("name", placeJSON);
            placeCode = getInt("code", placeJSON);
        } else {
            placeName = null;
            placeCode = -1;
        }
        name = getUnescapedString("name", location);
        url = getUnescapedString("url", location);
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:21,代码来源:LocationJSONImpl.java


示例16: createLocationList

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
static ResponseList<Location> createLocationList(JSONArray list, boolean storeJSON) throws TwitterException {
    try {
        int size = list.length();
        ResponseList<Location> locations =
                new ResponseListImpl<Location>(size, null);
        for (int i = 0; i < size; i++) {
            JSONObject json = list.getJSONObject(i);
            Location location = new LocationJSONImpl(json);
            locations.add(location);
            if (storeJSON) {
                DataObjectFactoryUtil.registerJSONObject(location, json);
            }
        }
        if (storeJSON) {
            DataObjectFactoryUtil.registerJSONObject(locations, list);
        }
        return locations;
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    } catch (TwitterException te) {
        throw te;
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:24,代码来源:LocationJSONImpl.java


示例17: buildTweetFromMessage

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
/**
	 * 
	 * @param msg 			Message returned from the twitter stream. Includes all of the meta-data
	 * @throws JSONException Could throw a JSON exception if the message is null.
	 */
	public static void buildTweetFromMessage(String msg) throws JSONException{
		//use a JSON object to parse the tweet
		JSONObject obj = new JSONObject(msg);
		JSONObject author = new JSONObject(obj.getString("user"));
		String userName = author.getString("name");
		String text = obj.getString("text");
		text = stripCommas(text);
		String date = obj.getString("created_at");
		//get the time and date out of the big date string
		String[] split = date.split(" ");
		//get the time position
		String[] timeSplit = split[3].split(":");
		String time = timeSplit[0] + ":" + timeSplit[1];
		date = split[1] + " " + split[2];
		
//		//Tweet tMessage = new Tweet(userName, date, time, text);
//		//System.out.println(tMessage);
//		if(db.saveTweet(tMessage)){
//			System.out.println("message successfully saved!");
//		}
//		else{
//			System.out.println("the message was not saved :(");
//		}
//		
	}
 
开发者ID:jmaupin82,项目名称:Twitter-Analyzer,代码行数:31,代码来源:Crawler.java


示例18: testProfileImageURL

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
public void testProfileImageURL() throws JSONException, TwitterException {
    String rawJsonWithoutProfileImageExtension = "{\"id\":400609977,\"id_str\":\"400609977\",\"name\":\"Chris Bautista\",\"screen_name\":\"ayecrispy\",\"location\":\"Jacksonville, FL\",\"description\":\"I'm a gamer and will always be one. I like to keep up with the entertainment life. Where it's celebrities, technology or trying to keep up with latest trend\",\"url\":null,\"entities\":{\"description\":{\"urls\":[]}},\"protected\":false,\"followers_count\":17,\"friends_count\":177,\"listed_count\":0,\"created_at\":\"Sat Oct 29 09:23:10 +0000 2011\",\"favourites_count\":0,\"utc_offset\":-18000,\"time_zone\":\"Eastern Time (US & Canada)\",\"geo_enabled\":false,\"verified\":false,\"statuses_count\":113,\"lang\":\"en\",\"status\":{\"created_at\":\"Sun Dec 16 02:37:57 +0000 2012\",\"id\":280139673333035008,\"id_str\":\"280139673333035008\",\"text\":\"Gotta love olive Garden!\",\"source\":\"\\u003ca href=\\\"http:\\/\\/tweedleapp.com\\/\\\" rel=\\\"nofollow\\\"\\u003e Tweedle\\u003c\\/a\\u003e\",\"truncated\":false,\"in_reply_to_status_id\":null,\"in_reply_to_status_id_str\":null,\"in_reply_to_user_id\":null,\"in_reply_to_user_id_str\":null,\"in_reply_to_screen_name\":null,\"geo\":null,\"coordinates\":null,\"place\":null,\"contributors\":null,\"retweet_count\":0,\"entities\":{\"hashtags\":[],\"urls\":[],\"user_mentions\":[]},\"favorited\":false,\"retweeted\":false},\"contributors_enabled\":false,\"is_translator\":false,\"profile_background_color\":\"1A1B1F\",\"profile_background_image_url\":\"http:\\/\\/a0.twimg.com\\/images\\/themes\\/theme9\\/bg.gif\",\"profile_background_image_url_https\":\"https:\\/\\/si0.twimg.com\\/images\\/themes\\/theme9\\/bg.gif\",\"profile_background_tile\":false,\"profile_image_url\":\"http:\\/\\/a0.twimg.com\\/profile_images\\/1835646533\\/gu44kEhi_normal\",\"profile_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_images\\/1835646533\\/gu44kEhi_normal\",\"profile_link_color\":\"2FC2EF\",\"profile_sidebar_border_color\":\"181A1E\",\"profile_sidebar_fill_color\":\"252429\",\"profile_text_color\":\"666666\",\"profile_use_background_image\":true,\"default_profile\":false,\"default_profile_image\":false,\"following\":false,\"follow_request_sent\":false,\"notifications\":false}";
    JSONObject jsonWithoutProfileImageExtension = new JSONObject(rawJsonWithoutProfileImageExtension);
    UserJSONImpl userWithoutProfileImageExtension = new UserJSONImpl(jsonWithoutProfileImageExtension);

    assertEquals("http://a0.twimg.com/profile_images/1835646533/gu44kEhi_bigger", userWithoutProfileImageExtension.getBiggerProfileImageURL());
    assertEquals("https://si0.twimg.com/profile_images/1835646533/gu44kEhi_bigger", userWithoutProfileImageExtension.getBiggerProfileImageURLHttps());
    assertEquals("http://a0.twimg.com/profile_images/1835646533/gu44kEhi", userWithoutProfileImageExtension.getOriginalProfileImageURL());
    assertEquals("https://si0.twimg.com/profile_images/1835646533/gu44kEhi", userWithoutProfileImageExtension.getOriginalProfileImageURLHttps());

    String rawJsonWithProfileImageExtension = "{\"id\":613742117,\"id_str\":\"613742117\",\"name\":\"Tweedle\",\"screen_name\":\"tweedleapp\",\"location\":\"\",\"description\":\"Twitter application for Android, follow this account for updates.\\r\\n\\r\\nDeveloped by @HandlerExploit\",\"url\":\"http:\\/\\/tweedleapp.com\",\"entities\":{\"url\":{\"urls\":[{\"url\":\"http:\\/\\/tweedleapp.com\",\"expanded_url\":null,\"indices\":[0,21]}]},\"description\":{\"urls\":[]}},\"protected\":false,\"followers_count\":2210,\"friends_count\":1,\"listed_count\":20,\"created_at\":\"Wed Jun 20 20:42:48 +0000 2012\",\"favourites_count\":1,\"utc_offset\":null,\"time_zone\":null,\"geo_enabled\":false,\"verified\":false,\"statuses_count\":323,\"lang\":\"en\",\"status\":{\"created_at\":\"Sun Dec 16 06:47:33 +0000 2012\",\"id\":280202487317790721,\"id_str\":\"280202487317790721\",\"text\":\"@bcw_ It is better in some aspects, but in others it is not ideal. We need to add a way to notify the user better though.\",\"source\":\"web\",\"truncated\":false,\"in_reply_to_status_id\":280202314080464896,\"in_reply_to_status_id_str\":\"280202314080464896\",\"in_reply_to_user_id\":101066646,\"in_reply_to_user_id_str\":\"101066646\",\"in_reply_to_screen_name\":\"bcw_\",\"geo\":null,\"coordinates\":null,\"place\":null,\"contributors\":null,\"retweet_count\":0,\"entities\":{\"hashtags\":[],\"urls\":[],\"user_mentions\":[{\"screen_name\":\"bcw_\",\"name\":\"Verified Bradley\",\"id\":101066646,\"id_str\":\"101066646\",\"indices\":[0,5]}]},\"favorited\":false,\"retweeted\":false},\"contributors_enabled\":false,\"is_translator\":false,\"profile_background_color\":\"C0DEED\",\"profile_background_image_url\":\"http:\\/\\/a0.twimg.com\\/images\\/themes\\/theme1\\/bg.png\",\"profile_background_image_url_https\":\"https:\\/\\/si0.twimg.com\\/images\\/themes\\/theme1\\/bg.png\",\"profile_background_tile\":false,\"profile_image_url\":\"http:\\/\\/a0.twimg.com\\/profile_images\\/2433552309\\/dltv4u9hajvoxsne5bly_normal.png\",\"profile_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_images\\/2433552309\\/dltv4u9hajvoxsne5bly_normal.png\",\"profile_link_color\":\"0084B4\",\"profile_sidebar_border_color\":\"C0DEED\",\"profile_sidebar_fill_color\":\"DDEEF6\",\"profile_text_color\":\"333333\",\"profile_use_background_image\":true,\"default_profile\":true,\"default_profile_image\":false,\"following\":true,\"follow_request_sent\":false,\"notifications\":false}";
    JSONObject jsonWithProfileImageExtension = new JSONObject(rawJsonWithProfileImageExtension);
    UserJSONImpl userWithProfileImageExtension = new UserJSONImpl(jsonWithProfileImageExtension);

    assertEquals(userWithProfileImageExtension.getBiggerProfileImageURL(), "http://a0.twimg.com/profile_images/2433552309/dltv4u9hajvoxsne5bly_bigger.png");
    assertEquals(userWithProfileImageExtension.getOriginalProfileImageURL(), "http://a0.twimg.com/profile_images/2433552309/dltv4u9hajvoxsne5bly.png");
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:18,代码来源:UserJSONImplTest.java


示例19: init

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
private void init(JSONObject json) throws TwitterException {
        try {
            html = json.getString("html");
            authorName = json.getString("author_name");
            url = json.getString("url");
            version = json.getString("version");
            cacheAge = json.getLong("cache_age");
            authorURL = json.getString("author_url");
            width = json.getInt("width");
            // provider_url provider_name, type always return same value
            // there is no need to parse them and expose the values via OEmbed interface
//            providerURL = json.getString("provider_url");
//            providerName = json.getString("provider_name");
//            type = json.getString("type");
        } catch (JSONException jsone) {
            throw new TwitterException(jsone);
        }
    }
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:19,代码来源:OEmbedJSONImpl.java


示例20: createRateLimitStatuses

import twitter4j.internal.org.json.JSONObject; //导入依赖的package包/类
static Map<String,RateLimitStatus> createRateLimitStatuses(JSONObject json) throws TwitterException {
    Map<String, RateLimitStatus> map = new HashMap<String, RateLimitStatus>();
    try {
        JSONObject resources = json.getJSONObject("resources");
        Iterator resourceKeys = resources.keys();
        while (resourceKeys.hasNext()) {
            JSONObject resource = resources.getJSONObject((String) resourceKeys.next());
            Iterator endpointKeys = resource.keys();
            while (endpointKeys.hasNext()) {
                String endpoint = (String) endpointKeys.next();
                JSONObject rateLimitStatusJSON = resource.getJSONObject(endpoint);
                RateLimitStatus rateLimitStatus = new RateLimitStatusJSONImpl(rateLimitStatusJSON);
                map.put(endpoint, rateLimitStatus);
            }
        }
        return Collections.unmodifiableMap(map);
    } catch (JSONException jsone) {
        throw new TwitterException(jsone);
    }
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:21,代码来源:RateLimitStatusJSONImpl.java



注:本文中的twitter4j.internal.org.json.JSONObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExceptionReporter类代码示例发布时间:2022-05-23
下一篇:
Java RawPacket类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap