本文整理汇总了Java中twitter4j.internal.org.json.JSONArray.getString方法的典型用法代码示例。如果您正苦于以下问题:Java JSONArray.getString方法的具体用法?Java JSONArray.getString怎么用?Java JSONArray.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter4j.internal.org.json.JSONArray
的用法示例。
在下文中一共展示了JSONArray.getString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FriendshipJSONImpl
import twitter4j.internal.org.json.JSONArray; //导入方法依赖的package包/类
FriendshipJSONImpl(JSONObject json) throws TwitterException {
super();
try {
id = getLong("id", json);
name = json.getString("name");
screenName = json.getString("screen_name");
JSONArray connections = json.getJSONArray("connections");
for (int i = 0; i < connections.length(); i++) {
String connection = connections.getString(i);
if ("following".equals(connection)) {
following = true;
} else if ("followed_by".equals(connection)) {
followedBy = true;
}
}
} catch (JSONException jsone) {
throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
}
}
示例2: TwitterAPIConfigurationJSONImpl
import twitter4j.internal.org.json.JSONArray; //导入方法依赖的package包/类
TwitterAPIConfigurationJSONImpl(HttpResponse res, Configuration conf)
throws TwitterException {
super(res);
try {
JSONObject json = res.asJSONObject();
photoSizeLimit = getInt("photo_size_limit", json);
shortURLLength = getInt("short_url_length", json);
shortURLLengthHttps = getInt("short_url_length_https", json);
charactersReservedPerMedia = getInt("characters_reserved_per_media", json);
JSONObject sizes = json.getJSONObject("photo_sizes");
photoSizes = new HashMap<Integer, MediaEntity.Size>(4);
photoSizes.put(MediaEntity.Size.LARGE, new MediaEntityJSONImpl.Size(sizes.getJSONObject("large")));
JSONObject medium;
// http://code.google.com/p/twitter-api/issues/detail?id=2230
if (sizes.isNull("med")) {
medium = sizes.getJSONObject("medium");
} else {
medium = sizes.getJSONObject("med");
}
photoSizes.put(MediaEntity.Size.MEDIUM, new MediaEntityJSONImpl.Size(medium));
photoSizes.put(MediaEntity.Size.SMALL, new MediaEntityJSONImpl.Size(sizes.getJSONObject("small")));
photoSizes.put(MediaEntity.Size.THUMB, new MediaEntityJSONImpl.Size(sizes.getJSONObject("thumb")));
if (conf.isJSONStoreEnabled()) {
DataObjectFactoryUtil.clearThreadLocalMap();
DataObjectFactoryUtil.registerJSONObject(this, res.asJSONObject());
}
JSONArray nonUsernamePathsJSONArray = json.getJSONArray("non_username_paths");
nonUsernamePaths = new String[nonUsernamePathsJSONArray.length()];
for (int i = 0; i < nonUsernamePathsJSONArray.length(); i++) {
nonUsernamePaths[i] = nonUsernamePathsJSONArray.getString(i);
}
maxMediaPerUpload = getInt("max_media_per_upload", json);
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
}