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

Java InputFactoryImpl类代码示例

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

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



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

示例1: getXmlMapper

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
protected XmlMapper getXmlMapper() {
    final XmlMapper xmlMapper = new XmlMapper(
            new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
    xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(ODataClient.class, client));
    xmlMapper.addHandler(new DeserializationProblemHandler() {

        @Override
        public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp,
                final JsonDeserializer<?> deserializer, final Object beanOrClass, final String propertyName)
                throws IOException, JsonProcessingException {

            // skip any unknown property
            LOG.warn("Skipping unknown property {}", propertyName);
            ctxt.getParser().skipChildren();
            return true;
        }
    });
    return xmlMapper;
}
 
开发者ID:ashank,项目名称:Office-365-SDK-for-Android,代码行数:20,代码来源:AbstractODataDeserializer.java


示例2: getXmlMapper

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
protected XmlMapper getXmlMapper() {
  final XmlMapper xmlMapper = new XmlMapper(
      new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());

  xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(Boolean.class, Boolean.FALSE));

  xmlMapper.addHandler(new DeserializationProblemHandler() {
    @Override
    public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp,
        final com.fasterxml.jackson.databind.JsonDeserializer<?> deserializer,
        final Object beanOrClass, final String propertyName)
        throws IOException, JsonProcessingException {

      // skip any unknown property
      ctxt.getParser().skipChildren();
      return true;
    }
  });
  return xmlMapper;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:21,代码来源:ClientODataDeserializerImpl.java


示例3: split

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
/**
 * Use the {@link FirstLevelSplitter} and split an XML string
 * @param xml the XML string
 * @return the chunks created by the splitter
 * @throws Exception if the XML string could not be parsed
 */
private List<Result<XMLChunkMeta>> split(String xml) throws Exception {
  Window window = new Window();
  window.append(Buffer.buffer(xml));
  AsyncXMLInputFactory xmlInputFactory = new InputFactoryImpl();
  AsyncXMLStreamReader<AsyncByteArrayFeeder> reader =
      xmlInputFactory.createAsyncForByteArray();
  byte[] xmlBytes = xml.getBytes(StandardCharsets.UTF_8);
  reader.getInputFeeder().feedInput(xmlBytes, 0, xmlBytes.length);
  FirstLevelSplitter splitter = new FirstLevelSplitter(window);
  List<Result<XMLChunkMeta>> chunks = new ArrayList<>();
  while (reader.hasNext()) {
    int event = reader.next();
    if (event == AsyncXMLStreamReader.EVENT_INCOMPLETE) {
      reader.close();
      continue;
    }
    int pos = reader.getLocation().getCharacterOffset();
    Result<XMLChunkMeta> chunk = splitter.onEvent(
        new XMLStreamEvent(event, pos, reader));
    if (chunk != null) {
      chunks.add(chunk);
    }
  }
  return chunks;
}
 
开发者ID:georocket,项目名称:georocket,代码行数:32,代码来源:FirstLevelSplitterTest.java


示例4: toMetadata

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
public static Edmx toMetadata(final InputStream input) {
    try {
        final XmlMapper xmlMapper = new XmlMapper(
                new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
        xmlMapper.addHandler(new DeserializationProblemHandler() {

            @Override
            public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp,
                    final JsonDeserializer<?> deserializer, final Object beanOrClass, final String propertyName)
                    throws IOException, JsonProcessingException {

                // 1. special handling of AbstractAnnotatedEdm's fields
                if (beanOrClass instanceof AbstractAnnotatedEdm
                        && AbstractAnnotatedEdmUtils.isAbstractAnnotatedProperty(propertyName)) {

                    AbstractAnnotatedEdmUtils.parseAnnotatedEdm((AbstractAnnotatedEdm) beanOrClass, jp);
                } // 2. skip any other unknown property
                else {
                    ctxt.getParser().skipChildren();
                }

                return true;
            }
        });
        return xmlMapper.readValue(input, Edmx.class);
    } catch (Exception e) {
        throw new IllegalArgumentException("Could not parse as Edmx document", e);
    }
}
 
开发者ID:mkostin,项目名称:ODataJClient,代码行数:30,代码来源:Deserializer.java


示例5: createDefaultMapper

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
public static XmlMapper createDefaultMapper() {
    XmlFactory f = new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl());
    
    XmlMapper mapper = new XmlMapper(f);
    mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    mapper.configure(MapperFeature.AUTO_DETECT_GETTERS, false);
    mapper.configure(MapperFeature.AUTO_DETECT_IS_GETTERS, false);
    mapper.configure(MapperFeature.AUTO_DETECT_SETTERS, false);
    return mapper;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:12,代码来源:XmlObjectTask.java


示例6: toODataErrorFromXML

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
protected XMLODataError toODataErrorFromXML(final InputStream input) {
    try {
        final XmlMapper xmlMapper = new XmlMapper(
                new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
        return xmlMapper.readValue(input, XMLODataError.class);
    } catch (Exception e) {
        throw new IllegalArgumentException("While deserializing XML error", e);
    }
}
 
开发者ID:ashank,项目名称:Office-365-SDK-for-Android,代码行数:10,代码来源:AbstractODataDeserializer.java


示例7: toODataErrorFromXML

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
private static XMLODataError toODataErrorFromXML(final InputStream input) {
    try {
        final XmlMapper xmlMapper = new XmlMapper(
                new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
        return xmlMapper.readValue(input, XMLODataError.class);
    } catch (Exception e) {
        throw new IllegalArgumentException("While deserializing XML error", e);
    }
}
 
开发者ID:mkostin,项目名称:ODataJClient,代码行数:10,代码来源:Deserializer.java


示例8: StreamingXmlGraphParser

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
public StreamingXmlGraphParser(WayTag[] includedWayTags, WayTag[] excludedWayTags) {
    this.inputFactory = InputFactoryImpl.newFactory();
    this.includedWayTags = includedWayTags;
    this.excludedWayTags = excludedWayTags;
}
 
开发者ID:rovaniemi,项目名称:osm-graph-parser,代码行数:6,代码来源:StreamingXmlGraphParser.java


示例9: XmlInputStream

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
public XmlInputStream(InputStream inputStream) throws IOException {

        if(inputStream == null) {
            throw new IllegalArgumentException("inputStream should never be null");
        } else {
            this.is = inputStream;

            try {

                AsyncXMLInputFactory f = new InputFactoryImpl();
                f.configureForSpeed();

                Reader reader = new InputStreamReader(is,encoding);

                stream = (EventReaderImpl) f.createXMLEventReader(reader);


                //this.stream = ms_fact.createXMLEventReader(this.is);

            } catch (XMLStreamException var3) {
                throw new IOException(var3);
            }
        }
    }
 
开发者ID:automenta,项目名称:spimedb,代码行数:25,代码来源:XmlInputStream.java


示例10: testFullXml

import com.fasterxml.aalto.stax.InputFactoryImpl; //导入依赖的package包/类
@Test
public void testFullXml() throws Exception {
	InputFactoryImpl inputFactory = new InputFactoryImpl();
	AsyncXMLStreamReader streamReader = inputFactory.createAsyncXMLStreamReader();
	AsyncInputFeeder asyncInputFeeder = streamReader.getInputFeeder();
	
	byte[] xmlData = 
			(	"<?xml version='1.0'?>"
			+	"<someRootElement someAttribute='someAttributeValue' xmlns='http://someDomain.com/somePath'>"
			+		"<!-- Some Comment -->"
			+ 		"<someChildElement someChildElementAttribute='someChildElementAttributeValue'/>"
			+ 	"</someRootElement>").getBytes(StandardCharsets.UTF_8);
	
	asyncInputFeeder.feedInput(xmlData, 0, xmlData.length);
	
	StAXElementBuilder elementBuilder = new StAXElementBuilder(true);
	
	int event = -1;
	int elementsActive = 0;
	
	while ((event = streamReader.next()) > 0) {
		elementsActive += (event == 1 ? 1 : 0);
		elementsActive -= (event == 2 ? 1 : 0);

		elementBuilder.process(streamReader);
		
		if (event != 7 && elementsActive < 1) {
			break;
		}
	}
	
	Element someRootElement = elementBuilder.getElement();
	
	Assert.assertNotNull(someRootElement);
	Assert.assertEquals("someRootElement", someRootElement.getName());
	Assert.assertEquals("someAttributeValue", someRootElement.getAttributeValue("someAttribute"));
	Assert.assertEquals("http://someDomain.com/somePath", someRootElement.getNamespaceURI());
	
	Element someChildElement = someRootElement.getChildren().get(0);

	Assert.assertNotNull(someChildElement);
	Assert.assertEquals("someChildElement", someChildElement.getName());
	Assert.assertEquals("someChildElementAttributeValue", someChildElement.getAttributeValue("someChildElementAttribute"));
}
 
开发者ID:Kixeye,项目名称:kixmpp,代码行数:45,代码来源:StAXElementBuilderTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java SharedResourceObject类代码示例发布时间:2022-05-22
下一篇:
Java VuforiaTrackableDefaultListener类代码示例发布时间: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