public Reader constructReader() throws IOException { String enc = getEncoding(); InputStream in = constructInputStream(); if (enc != null && enc.length() > 0) { return new InputStreamReader(in, enc); } // Sub-optimal; really shouldn't use the platform default encoding return new InputStreamReader(in); }
/** * Method for constructing Stax stream reader to read contents * of (portion of) specified byte array, using Stax input factory * this StaxMate factory was constructed with. */ public XMLStreamReader2 createStax2Reader(byte[] data, int offset, int len) throws XMLStreamException { Stax2ByteArraySource src = new Stax2ByteArraySource(data, offset, len); if (_stax2Factory != null) { return (XMLStreamReader2) _stax2Factory.createXMLStreamReader(src); } try { XMLStreamReader sr = _staxFactory.createXMLStreamReader(src.constructInputStream()); return wrapIfNecessary(sr); } catch (IOException ioe) { throw new XMLStreamException(ioe); } }
bs = StreamBootstrapper.getInstance(pubId, SystemId.construct(sysId), bas.getBuffer(), bas.getBufferStart(), bas.getBufferEnd()); } else { in = ss.constructInputStream();
Stax2ByteArraySource bs = (Stax2ByteArraySource) ss; return StreamReaderImpl.construct(ByteSourceBootstrapper.construct (cfg, bs.getBuffer(), bs.getBufferStart(), bs.getBufferLength()));
/** * Overridable factory method that actually instantiates desired * parser. */ @Override protected FromXmlParser _createJsonParser(byte[] data, int offset, int len, IOContext ctxt) throws IOException, JsonParseException { XMLStreamReader sr; try { sr = _xmlInputFactory.createXMLStreamReader(new Stax2ByteArraySource(data, offset, len)); sr = _initializeXmlReader(sr); } catch (XMLStreamException e) { return StaxUtil.throwXmlAsIOException(e); } return new FromXmlParser(ctxt, _generatorFeatures, _xmlGeneratorFeatures, _objectCodec, sr); }
Stax2ByteArraySource bs = (Stax2ByteArraySource) ss; return StreamReaderImpl.construct(ByteSourceBootstrapper.construct (cfg, bs.getBuffer(), bs.getBufferStart(), bs.getBufferLength()));
@Override protected FromXmlParser _createParser(byte[] data, int offset, int len, IOContext ctxt) throws IOException { XMLStreamReader sr; try { sr = _xmlInputFactory.createXMLStreamReader(new Stax2ByteArraySource(data, offset, len)); sr = _initializeXmlReader(sr); } catch (XMLStreamException e) { return StaxUtil.throwXmlAsIOException(e); } FromXmlParser xp = new FromXmlParser(ctxt, _generatorFeatures, _xmlGeneratorFeatures, _objectCodec, sr); if (_cfgNameForTextElement != null) { xp.setXMLTextElementName(_cfgNameForTextElement); } return xp; }
bs = StreamBootstrapper.getInstance(pubId, SystemId.construct(sysId), bas.getBuffer(), bas.getBufferStart(), bas.getBufferEnd()); } else { in = ss.constructInputStream();
public Reader constructReader() throws IOException { String enc = getEncoding(); InputStream in = constructInputStream(); if (enc != null && enc.length() > 0) { return new InputStreamReader(in, enc); } // Sub-optimal; really shouldn't use the platform default encoding return new InputStreamReader(in); }
/** * Method for constructing Stax stream reader to read contents * of (portion of) specified byte array, using Stax input factory * this StaxMate factory was constructed with. */ public XMLStreamReader2 createStax2Reader(byte[] data, int offset, int len) throws XMLStreamException { Stax2ByteArraySource src = new Stax2ByteArraySource(data, offset, len); if (_stax2Factory != null) { return (XMLStreamReader2) _stax2Factory.createXMLStreamReader(src); } try { XMLStreamReader sr = _staxFactory.createXMLStreamReader(src.constructInputStream()); return wrapIfNecessary(sr); } catch (IOException ioe) { throw new XMLStreamException(ioe); } }
@Override protected FromXmlParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len) throws IOException { XMLStreamReader sr; try { sr = _xmlInputFactory.createXMLStreamReader(new Stax2ByteArraySource(data, offset, len)); } catch (XMLStreamException e) { return StaxUtil.throwAsParseException(e, null); } sr = _initializeXmlReader(sr); FromXmlParser xp = new FromXmlParser(readCtxt, ioCtxt, readCtxt.getStreamReadFeatures(_streamReadFeatures), readCtxt.getFormatReadFeatures(_formatReadFeatures), sr); if (_cfgNameForTextElement != null) { xp.setXMLTextElementName(_cfgNameForTextElement); } return xp; }
bs = StreamBootstrapper.getInstance(pubId, SystemId.construct(sysId), bas.getBuffer(), bas.getBufferStart(), bas.getBufferEnd()); } else { in = ss.constructInputStream();
public Reader constructReader() throws IOException { String enc = getEncoding(); InputStream in = constructInputStream(); if (enc != null && enc.length() > 0) { return new InputStreamReader(in, enc); } // Sub-optimal; really shouldn't use the platform default encoding return new InputStreamReader(in); }
bs = StreamBootstrapper.getInstance(pubId, SystemId.construct(sysId), bas.getBuffer(), bas.getBufferStart(), bas.getBufferEnd()); } else { in = ss.constructInputStream();
/** * Note: if encoding is not explicitly defined, UTF-8 is assumed. */ public Reader constructReader() throws IOException { String enc = getEncoding(); InputStream in = constructInputStream(); if (enc == null || enc.length() == 0) { /* 11-Nov-2008, TSa: Used to rely on platform default encoding, which * doesn't make sense. XML assumes UTF-8 anyway. */ enc = DEFAULT_ENCODING; } return new InputStreamReader(in, enc); }
bs = StreamBootstrapper.getInstance(pubId, SystemId.construct(sysId), bas.getBuffer(), bas.getBufferStart(), bas.getBufferEnd()); } else { in = ss.constructInputStream();