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

Java ContentHandler类代码示例

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

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



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

示例1: fromJson

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
public VPackSlice fromJson(final String json, final boolean includeNullValues) throws VPackException {
	final VPackBuilder builder = new VPackBuilder();
	final JSONParser parser = new JSONParser();
	final ContentHandler contentHandler = new VPackContentHandler(builder, includeNullValues, this);
	try {
		parser.parse(json, contentHandler);
	} catch (final ParseException e) {
		throw new VPackBuilderException(e);
	}
	return builder.slice();
}
 
开发者ID:arangodb,项目名称:java-velocypack,代码行数:12,代码来源:VPackParser.java


示例2: getContentHandler

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
protected ContentHandler getContentHandler() {
	return new BaseContentHandler() {

		public boolean primitive(Object value) throws ParseException, IOException {
			String key = (String) objects.peek();
			if ("text".equals(key)) {
				query = (String) value;
			} else if ("id".equals(key)) {
				String parentKey = (String) objects.elementAt(objects.size() - 2);
				if ("persons".equals(parentKey)) {
					persons++;
				} else if ("texts".equals(parentKey)) {
					texts++;
				} else if ("books".equals(parentKey)) {
					books++;
				} else if ("series".equals(parentKey)) {
					series++;
				} else if ("sequences".equals(parentKey)) {
					sequences++;
				} else if ("labels".equals(parentKey)) {
					labels++;
				} else if ("categories".equals(parentKey)) {
					categories++;
				}
			}
			return true;
		}
	};
}
 
开发者ID:kaloyan-raev,项目名称:chitanka4kindle,代码行数:30,代码来源:SearchOverview.java


示例3: getContentHandler

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
protected ContentHandler getContentHandler() {
	return new BaseContentHandler() {

		public boolean endArray() throws ParseException, IOException {
			return !SERIES_KEY.equals(getParentKey());
		}

		public boolean startObject() throws ParseException, IOException {
			if (SERIES_KEY.equals(getParentKey())) {
				series.add(new Serie());
			}
			return true;
		}

		public boolean primitive(Object value) throws ParseException, IOException {
			String key = (String) objects.peek();
			if ("slug".equals(key)) {
				if (SERIES_KEY.equals(getParentKey(2))) {
					getLast().setSlug((String) value);
				}
			} else if ("name".equals(key)) {
				if (SERIES_KEY.equals(getParentKey(2))) {
					getLast().setName((String) value);
				}
			}
			return true;
		}
	};
}
 
开发者ID:kaloyan-raev,项目名称:chitanka4kindle,代码行数:30,代码来源:SearchSeries.java


示例4: getContentHandler

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
protected ContentHandler getContentHandler() {
	return new BaseContentHandler() {

		public boolean endArray() throws ParseException, IOException {
			return !TEXTS_KEY.equals(getParentKey());
		}

		public boolean startObject() throws ParseException, IOException {
			if (TEXTS_KEY.equals(getParentKey())) {
				texts.add(new Text());
			}
			return true;
		}

		public boolean primitive(Object value) throws ParseException, IOException {
			String key = (String) objects.peek();
			if ("id".equals(key)) {
				if (TEXTS_KEY.equals(getParentKey(2))) {
					getLast().setId(((Long) value).intValue());
				}
			} else if ("title".equals(key)) {
				if (TEXTS_KEY.equals(getParentKey(2))) {
					getLast().setTitle((String) value);
				}
			}
			return true;
		}
	};
}
 
开发者ID:kaloyan-raev,项目名称:chitanka4kindle,代码行数:30,代码来源:SearchTexts.java


示例5: getContentHandler

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
protected ContentHandler getContentHandler() {
	return new BaseContentHandler() {

		public boolean endArray() throws ParseException, IOException {
			return !SEQUENCES_KEY.equals(getParentKey());
		}

		public boolean startObject() throws ParseException, IOException {
			if (SEQUENCES_KEY.equals(getParentKey())) {
				sequences.add(new Sequence());
			}
			return true;
		}

		public boolean primitive(Object value) throws ParseException, IOException {
			String key = (String) objects.peek();
			if ("slug".equals(key)) {
				if (SEQUENCES_KEY.equals(getParentKey(2))) {
					getLast().setSlug((String) value);
				}
			} else if ("name".equals(key)) {
				if (SEQUENCES_KEY.equals(getParentKey(2))) {
					getLast().setName((String) value);
				}
			} else if ("nrOfBooks".equals(key)) {
				if (SEQUENCES_KEY.equals(getParentKey(2))) {
					getLast().setNumberOfBooks(((Long) value).intValue());
				}
			}
			return true;
		}
	};
}
 
开发者ID:kaloyan-raev,项目名称:chitanka4kindle,代码行数:34,代码来源:SearchSequences.java


示例6: getContentHandler

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
protected ContentHandler getContentHandler() {
	return new BaseContentHandler() {

		public boolean endArray() throws ParseException, IOException {
			return !LABELS_KEY.equals(getParentKey());
		}

		public boolean startObject() throws ParseException, IOException {
			if (LABELS_KEY.equals(getParentKey())) {
				labels.add(new Label());
			}
			return true;
		}

		public boolean primitive(Object value) throws ParseException, IOException {
			String key = (String) objects.peek();
			if ("slug".equals(key)) {
				if (LABELS_KEY.equals(getParentKey(2))) {
					getLast().setSlug((String) value);
				}
			} else if ("name".equals(key)) {
				if (LABELS_KEY.equals(getParentKey(2))) {
					getLast().setName((String) value);
				}
			} else if ("nrOfTexts".equals(key)) {
				if (LABELS_KEY.equals(getParentKey(2))) {
					getLast().setNumberOfTexts(((Long) value).intValue());
				}
			}
			return true;
		}
	};
}
 
开发者ID:kaloyan-raev,项目名称:chitanka4kindle,代码行数:34,代码来源:SearchLabels.java


示例7: getContentHandler

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
protected ContentHandler getContentHandler() {
	return new BaseContentHandler() {

		public boolean endArray() throws ParseException, IOException {
			return !CATEGORIES_KEY.equals(getParentKey());
		}

		public boolean startObject() throws ParseException, IOException {
			if (CATEGORIES_KEY.equals(getParentKey())) {
				categories.add(new Category());
			}
			return true;
		}

		public boolean primitive(Object value) throws ParseException, IOException {
			String key = (String) objects.peek();
			if ("slug".equals(key)) {
				if (CATEGORIES_KEY.equals(getParentKey(2))) {
					getLast().setSlug((String) value);
				}
			} else if ("name".equals(key)) {
				if (CATEGORIES_KEY.equals(getParentKey(2))) {
					getLast().setName((String) value);
				}
			} else if ("nrOfBooks".equals(key)) {
				if (CATEGORIES_KEY.equals(getParentKey(2))) {
					getLast().setNumberOfBooks(((Long) value).intValue());
				}
			}
			return true;
		}
	};
}
 
开发者ID:kaloyan-raev,项目名称:chitanka4kindle,代码行数:34,代码来源:SearchCategories.java


示例8: getContentHandler

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
protected ContentHandler getContentHandler() {
	return new BaseContentHandler() {

		public boolean endArray() throws ParseException, IOException {
			return !PERSONS_KEY.equals(getParentKey());
		}

		public boolean startObject() throws ParseException, IOException {
			if (PERSONS_KEY.equals(getParentKey())) {
				persons.add(new Person());
			}
			return true;
		}

		public boolean primitive(Object value) throws ParseException, IOException {
			String key = (String) objects.peek();
			if ("slug".equals(key)) {
				if (PERSONS_KEY.equals(getParentKey(2))) {
					getLast().setSlug((String) value);
				}
			} else if ("name".equals(key)) {
				if (PERSONS_KEY.equals(getParentKey(2))) {
					getLast().setName((String) value);
				}
			} else if ("isAuthor".equals(key)) {
				if (PERSONS_KEY.equals(getParentKey(2))) {
					getLast().setAuthor(((Boolean) value).booleanValue());
				}
			}
			return true;
		}
	};
}
 
开发者ID:kaloyan-raev,项目名称:chitanka4kindle,代码行数:34,代码来源:SearchPersons.java


示例9: handleSubs

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
public void handleSubs(boolean unread, int fromId, int limit, ContentHandler handler)
        throws IOException, ParseException, ReaderException {
    new JSONParser().parse(readSubs(unread, fromId, limit), handler);
}
 
开发者ID:t1h,项目名称:LDRuck,代码行数:5,代码来源:ApiClient.java


示例10: handleAll

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
public void handleAll(long subId, int offset, int limit, ContentHandler handler)
        throws IOException, ParseException, ReaderException {
    new JSONParser().parse(readAll(subId, offset, limit), handler);
}
 
开发者ID:t1h,项目名称:LDRuck,代码行数:5,代码来源:ApiClient.java


示例11: handleUnread

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
public void handleUnread(long subId, ContentHandler handler)
        throws IOException, ParseException, ReaderException {
    new JSONParser().parse(readUnread(subId), handler);
}
 
开发者ID:t1h,项目名称:LDRuck,代码行数:5,代码来源:ApiClient.java


示例12: handlePinAll

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
public void handlePinAll(ContentHandler handler)
        throws IOException, ParseException, ReaderException {
    new JSONParser().parse(readPinAll(), handler);
}
 
开发者ID:t1h,项目名称:LDRuck,代码行数:5,代码来源:ApiClient.java


示例13: getContentHandler

import org.json.simple.parser.ContentHandler; //导入依赖的package包/类
protected abstract ContentHandler getContentHandler(); 
开发者ID:kaloyan-raev,项目名称:chitanka4kindle,代码行数:2,代码来源:SearchParser.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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