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

Java JsonParserFactory类代码示例

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

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



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

示例1: testReader

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
void testReader (String fileName, HashMap<String, Object> config) throws IOException
{
	File file = new File (fileName.replace ('/', File.separatorChar));

	JsonProvider provider1 = new CookJsonProvider ();

	JsonParserFactory f1 = provider1.createParserFactory (config);

	StringWriter out1 = new StringWriter ();
	JsonParser p1 = f1.createParser (new InputStreamReader (new FileInputStream (file), BOM.utf8));
	JsonGenerator g1 = new TextJsonGenerator (out1);
	Utils.convert (p1, g1);
	p1.close ();
	g1.close ();

	StringWriter out2 = new StringWriter ();
	JsonProvider provider2 = new org.glassfish.json.JsonProviderImpl ();
	JsonParserFactory f2 = provider2.createParserFactory (config);
	JsonParser p2 = f2.createParser (new InputStreamReader (new FileInputStream (file), BOM.utf8));
	JsonGenerator g2 = new TextJsonGenerator (out2);
	Utils.convert (p2, g2);
	p2.close ();
	g2.close ();

	Assert.assertEquals (out1.toString (), out2.toString ());
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:27,代码来源:JsonParserFactoryTest.java


示例2: testInputStream

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
void testInputStream (String fileName, HashMap<String, Object> config) throws IOException
{
	File file = new File (fileName.replace ('/', File.separatorChar));

	JsonProvider provider1 = new CookJsonProvider ();

	JsonParserFactory f1 = provider1.createParserFactory (config);

	StringWriter out1 = new StringWriter ();
	JsonParser p1 = f1.createParser (new FileInputStream (file));
	JsonGenerator g1 = new TextJsonGenerator (out1);
	Utils.convert (p1, g1);
	p1.close ();
	g1.close ();

	StringWriter out2 = new StringWriter ();
	JsonProvider provider2 = new org.glassfish.json.JsonProviderImpl ();
	JsonParserFactory f2 = provider2.createParserFactory (config);
	JsonParser p2 = f2.createParser (new FileInputStream (file));
	JsonGenerator g2 = new TextJsonGenerator (out2);
	Utils.convert (p2, g2);
	p2.close ();
	g2.close ();

	Assert.assertEquals (out1.toString (), out2.toString ());
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:27,代码来源:JsonParserFactoryTest.java


示例3: testCharset

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
void testCharset (String fileName, HashMap<String, Object> config) throws IOException
{
	File file = new File (fileName.replace ('/', File.separatorChar));

	JsonProvider provider1 = new CookJsonProvider ();

	JsonParserFactory f1 = provider1.createParserFactory (config);

	StringWriter out1 = new StringWriter ();
	JsonParser p1 = f1.createParser (new FileInputStream (file), BOM.utf8);
	JsonGenerator g1 = new TextJsonGenerator (out1);
	Utils.convert (p1, g1);
	p1.close ();
	g1.close ();

	StringWriter out2 = new StringWriter ();
	JsonProvider provider2 = new org.glassfish.json.JsonProviderImpl ();
	JsonParserFactory f2 = provider2.createParserFactory (config);
	JsonParser p2 = f2.createParser (new FileInputStream (file), BOM.utf8);
	JsonGenerator g2 = new TextJsonGenerator (out2);
	Utils.convert (p2, g2);
	p2.close ();
	g2.close ();

	Assert.assertEquals (out1.toString (), out2.toString ());
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:27,代码来源:JsonParserFactoryTest.java


示例4: run

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
@Test
@Ignore("buggy but pushing to share the use case")
public void run() throws NoSuchFieldException, IllegalAccessException { // shouldnt fail by default
    final JsonParserFactory factory = Json.createParserFactory(emptyMap());
    final int length = 1024 * 1024;
    assertEquals(0, get(Queue.class, get(
            BufferStrategy.BufferProvider.class, factory, "bufferProvider"), "queue").size());
    try (final JsonParser parser = factory.createParser(newDynamicInput(length))) {
        int eventCount = 0;
        while (parser.hasNext()) {
            eventCount++;
            final JsonParser.Event next = parser.next();
            if (eventCount == 2 && next == JsonParser.Event.VALUE_STRING) {
                assertEquals(length, parser.getString().length());
            }
        }
    }
    assertEquals(1, get(Queue.class, get(
            BufferStrategy.BufferProvider.class, factory, "bufferProvider"), "queue").size());
}
 
开发者ID:apache,项目名称:johnzon,代码行数:21,代码来源:BrokenDefaultTest.java


示例5: createJsonParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
private Supplier<JsonParserFactory> createJsonParserFactory() {
    return new Supplier<JsonParserFactory>() { // thread safety is not mandatory
        private final AtomicReference<JsonParserFactory> ref = new AtomicReference<>();

        @Override
        public JsonParserFactory get() {
            JsonParserFactory factory = ref.get();
            if (factory == null) {
                factory = doCreate();
                if (!ref.compareAndSet(null, factory)) {
                    factory = ref.get();
                }
            }
            return factory;
        }

        private JsonParserFactory doCreate() {
            return (jsonp == null ? JsonProvider.provider() : jsonp).createParserFactory(emptyMap());
        }
    };
}
 
开发者ID:apache,项目名称:johnzon,代码行数:22,代码来源:JohnzonBuilder.java


示例6: createParser

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
private JsonParser createParser (JsonProvider provider, JsonValue value)
{
	HashMap<String, Object> config = new HashMap<String, Object> ();
	JsonParserFactory f = provider.createParserFactory (config);
	if (value instanceof JsonArray)
		return f.createParser ((JsonArray)value);
	else if (value instanceof JsonObject)
		return f.createParser ((JsonObject)value);
	throw new IllegalArgumentException ("Invalid value type.");
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:11,代码来源:JsonStructureParserTest.java


示例7: JsonbAccessMode

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
public JsonbAccessMode(final PropertyNamingStrategy propertyNamingStrategy, final String orderValue,
                       final PropertyVisibilityStrategy visibilityStrategy, final boolean caseSensitive,
                       final Map<AdapterKey, Adapter<?, ?>> defaultConverters, final JohnzonAdapterFactory factory,
                       final Supplier<JsonParserFactory> parserFactory, final AccessMode delegate) {
    this.naming = propertyNamingStrategy;
    this.order = orderValue;
    this.visibility = visibilityStrategy;
    this.caseSensitive = caseSensitive;
    this.delegate = delegate;
    this.defaultConverters = defaultConverters;
    this.factory = factory;
    this.parserFactory = parserFactory;
}
 
开发者ID:apache,项目名称:johnzon,代码行数:14,代码来源:JsonbAccessMode.java


示例8: createParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
public static JsonParserFactory createParserFactory()
{
  return getProvider().createParserFactory();
}
 
开发者ID:baratine,项目名称:baratine,代码行数:5,代码来源:Json.java


示例9:

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
public abstract JsonParserFactory
createParserFactory(JsonConfiguration config);
 
开发者ID:baratine,项目名称:baratine,代码行数:3,代码来源:JsonProvider.java


示例10: createParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
@Override
public JsonParserFactory createParserFactory (Map<String, ?> config)
{
	return new JsonParserFactoryImpl (config, getHandler (config));
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:6,代码来源:CookJsonProvider.java


示例11: parserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
@Override
public JsonParserFactory parserFactory()
{
    return parserFactory;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:6,代码来源:JavaxJsonFactories.java


示例12: createParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
public static JsonParserFactory createParserFactory(Map<String, ?> config) {
   return provider.createParserFactory(config);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:4,代码来源:JsonLoader.java


示例13: createParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
@Override
public JsonParserFactory createParserFactory(final Map<String, ?> stringMap) {
    return DELEGATE.createParserFactory(stringMap);
}
 
开发者ID:apache,项目名称:johnzon,代码行数:5,代码来源:JsonProviderImpl.java


示例14: getParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
@Override
public JsonParserFactory getParserFactory() {
    return parserFactory;
}
 
开发者ID:salyh,项目名称:jsr353-benchmark,代码行数:5,代码来源:JsonpRiParser.java


示例15: createParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
@Override
public JsonParserFactory createParserFactory( Map<String, ?> config ) {
    return defaultProvider.createParserFactory(config);
}
 
开发者ID:rhauch,项目名称:schematica,代码行数:5,代码来源:SchematicaJsonProvider.java


示例16: createParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
/**
 * Creates and configures {@link JsonParserFactory} object which implements Java API for JSON Processing.
 * @return created {@link JsonParserFactory} object to be used in the process of the validation.
 * @see JsonParserFactory
 * @see <a href="http://json-processing-spec.java.net/">JSR 353: Java API for JSON Processing</a>
 */
protected JsonParserFactory createParserFactory() {
	Map<String, ?> config = new HashMap<>();
	return Json.createParserFactory(config);
}
 
开发者ID:i49,项目名称:hibiscus,代码行数:11,代码来源:BasicJsonValidator.java


示例17: createParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
/**
 * Creates a parser factory for creating {@link JsonParser} objects.
 * The factory is configured with the specified map of provider specific
 * configuration properties. Provider implementations should ignore any
 * unsupported configuration properties specified in the map.
 *
 * @param config a map of provider specific properties to configure the
 *               JSON parsers. The map may be empty or null
 * @return JSON parser factory
 */
public static JsonParserFactory createParserFactory(Map<String, ?> config) {
    return PROVIDER_INSTANCE.createParserFactory(config);
}
 
开发者ID:rhauch,项目名称:schematica,代码行数:14,代码来源:Json.java


示例18: createParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
public abstract JsonParserFactory createParserFactory(); 
开发者ID:baratine,项目名称:baratine,代码行数:2,代码来源:JsonProvider.java


示例19: getParserFactory

import javax.json.stream.JsonParserFactory; //导入依赖的package包/类
public abstract JsonParserFactory getParserFactory(); 
开发者ID:salyh,项目名称:jsr353-benchmark,代码行数:2,代码来源:Jsr353Parser.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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