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); }
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); }
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); }
/** * 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); }
/** * 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); } }
/** * 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); } }