identityReaderFactory); return outputEncoding == null ? new ReaderInputStream(rdr) : new ReaderInputStream(rdr, outputEncoding);
/** * Reads from the <code>Reader</code>, returning the same value. * * @return the value of the next character in the <code>Reader</code>. * * @exception IOException if the original <code>Reader</code> fails to be read */ @Override public synchronized int read() throws IOException { if (in == null) { throw new IOException("Stream Closed"); } byte result; if (slack != null && begin < slack.length) { result = slack[begin]; if (++begin == slack.length) { slack = null; } } else { byte[] buf = new byte[1]; if (read(buf, 0, 1) <= 0) { return -1; } else { result = buf[0]; } } return result & BYTE_MASK; }
reader = helper.getAssembledReader(); outPumpIn = new ReaderInputStream(reader, outputEncoding); reader = helper.getAssembledReader(); errPumpIn = new ReaderInputStream(reader, errorEncoding); inputStream = new ReaderInputStream( helper.getAssembledReader(), inputEncoding);
@Override public void readAll(Reader r) throws IOException { Properties properties = new Properties(); if (this.isXml) { properties.loadFromXML(new ReaderInputStream(r)); } else { properties.load(r); } // Use "org.apache.tools.ant.taskdefs.Property" to prefix keys, expand values, and then set the // properties. this.delegate.addProperties(properties); } }
/** * parse the passed string into an {@link Element Element} object. * * @param elementToParse string to parse * @return result of parsing */ public Element parseIntoElement(String elementToParse) { try { Document parsed = this.builder.parse( new BufferedInputStream(new ReaderInputStream(new StringReader(elementToParse)))); return parsed.getDocumentElement(); } catch (Exception e) { throw new CargoException("Could not parse element: " + elementToParse); } }
/** * parse the passed string into an {@link Element Element} object. * * @param elementToParse string to parse * @return result of parsing */ public Element parseIntoElement(String elementToParse) { try { Document parsed = this.builder.parse( new BufferedInputStream(new ReaderInputStream(new StringReader(elementToParse)))); return parsed.getDocumentElement(); } catch (Exception e) { throw new CargoException("Could not parse element: " + elementToParse); } }
/** * Transforms the given InputStream. The original InputStream will be closed by the returned InputStream. */ public InputStream transform(InputStream original) { try { return new ReaderInputStream(transform(new InputStreamReader(original, charset)), charset); } catch (UnsupportedEncodingException e) { throw new UncheckedIOException(e); } }
@Override public Collection<FileAnnotation> parse(final Reader file) throws IOException, ParsingCanceledException { try { List<FileAnnotation> warnings = new ArrayList<FileAnnotation>(); SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); parser.parse(new ReaderInputStream(file, "UTF-8"), new JSLintXMLSaxParser(getGroup(), warnings)); return warnings; } catch (SAXException exception) { throw new IOException(exception); } catch (ParserConfigurationException exception) { throw new IOException(exception); } } }
@Override public Collection<FileAnnotation> parse(final Reader file) throws IOException, ParsingCanceledException { try { List<FileAnnotation> warnings = new ArrayList<FileAnnotation>(); SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); parser.parse(new ReaderInputStream(file, "UTF-8"), new JSLintXMLSaxParser(warnings)); return warnings; } catch (SAXException exception) { throw new IOException2(exception); } catch (ParserConfigurationException exception) { throw new IOException2(exception); } }