/** * Gets the contents of a <code>Reader</code> as a list of Strings, * one entry per line. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input the <code>Reader</code> to read from, not null * @return the list of Strings, never null * @throws NullPointerException if the input is null * @throws IOException if an I/O error occurs * @since 1.1 */ public static List<String> readLines(final Reader input) throws IOException { final BufferedReader reader = toBufferedReader(input); final List<String> list = new ArrayList<>(); String line = reader.readLine(); while (line != null) { list.add(line); line = reader.readLine(); } return list; }
input1 = toBufferedReader(input1); input2 = toBufferedReader(input2);
/** * Compares the contents of two Readers to determine if they are equal or * not, ignoring EOL characters. * <p> * This method buffers the input internally using * <code>BufferedReader</code> if they are not already buffered. * * @param input1 the first reader * @param input2 the second reader * @return true if the content of the readers are equal (ignoring EOL differences), false otherwise * @throws NullPointerException if either input is null * @throws IOException if an I/O error occurs * @since 2.2 */ public static boolean contentEqualsIgnoreEOL(final Reader input1, final Reader input2) throws IOException { if (input1 == input2) { return true; } final BufferedReader br1 = toBufferedReader(input1); final BufferedReader br2 = toBufferedReader(input2); String line1 = br1.readLine(); String line2 = br2.readLine(); while (line1 != null && line2 != null && line1.equals(line2)) { line1 = br1.readLine(); line2 = br2.readLine(); } return line1 == null ? line2 == null ? true : false : line1.equals(line2); }
/** * Get the reader to read the request. * * @return The reader */ @Override public BufferedReader reader() throws IOException { if (raw != null) { return IOUtils.toBufferedReader(new StringReader(raw)); } return null; }
@CheckForNull public static String getServerVersion() { InputStream is = BatchUtils.class.getResourceAsStream("/sq-version.txt"); if (is == null) { LOG.warn("Failed to get SQ version"); return null; } try (BufferedReader br = IOUtils.toBufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { return br.readLine(); } catch (IOException e) { LOG.warn("Failed to get SQ version", e); return null; } } }
/** * Compare the contents of two Readers to determine if they are equal or * not, ignoring EOL characters. * <p> * This method buffers the input internally using * <code>BufferedReader</code> if they are not already buffered. * * @param input1 the first reader * @param input2 the second reader * @return true if the content of the readers are equal (ignoring EOL differences), false otherwise * @throws NullPointerException if either input is null * @throws IOException if an I/O error occurs * @since 2.2 */ public static boolean contentEqualsIgnoreEOL(Reader input1, Reader input2) throws IOException { BufferedReader br1 = toBufferedReader(input1); BufferedReader br2 = toBufferedReader(input2); String line1 = br1.readLine(); String line2 = br2.readLine(); while (line1 != null && line2 != null && line1.equals(line2)) { line1 = br1.readLine(); line2 = br2.readLine(); } return line1 == null ? line2 == null ? true : false : line1.equals(line2); }
input1 = toBufferedReader(input1); input2 = toBufferedReader(input2);
/** * Compare the contents of two Readers to determine if they are equal or * not, ignoring EOL characters. * <p> * This method buffers the input internally using * <code>BufferedReader</code> if they are not already buffered. * * @param input1 the first reader * @param input2 the second reader * @return true if the content of the readers are equal (ignoring EOL differences), false otherwise * @throws NullPointerException if either input is null * @throws IOException if an I/O error occurs * @since 2.2 */ public static boolean contentEqualsIgnoreEOL(Reader input1, Reader input2) throws IOException { BufferedReader br1 = toBufferedReader(input1); BufferedReader br2 = toBufferedReader(input2); String line1 = br1.readLine(); String line2 = br2.readLine(); while (line1 != null && line2 != null && line1.equals(line2)) { line1 = br1.readLine(); line2 = br2.readLine(); } return line1 == null ? line2 == null ? true : false : line1.equals(line2); }
/** * Gets the reader to read the request. * * @return The reader */ @Override public BufferedReader reader() throws IOException { byte[] raw = request.getRawBody(); if (raw != null) { return IOUtils.toBufferedReader(new InputStreamReader(new ByteArrayInputStream(raw))); } return null; }
throws IOException { input1 = toBufferedReader(input1); input2 = toBufferedReader(input2);
throws IOException { input1 = toBufferedReader(input1); input2 = toBufferedReader(input2);
/** * Get the contents of a <code>Reader</code> as a list of Strings, * one entry per line. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input the <code>Reader</code> to read from, not null * @return the list of Strings, never null * @throws NullPointerException if the input is null * @throws IOException if an I/O error occurs * @since 1.1 */ public static List<String> readLines(Reader input) throws IOException { BufferedReader reader = toBufferedReader(input); List<String> list = new ArrayList<String>(); String line = reader.readLine(); while (line != null) { list.add(line); line = reader.readLine(); } return list; }
/** * Gets the contents of a <code>Reader</code> as a list of Strings, * one entry per line. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input the <code>Reader</code> to read from, not null * @return the list of Strings, never null * @throws NullPointerException if the input is null * @throws IOException if an I/O error occurs * @since 1.1 */ public static List<String> readLines(final Reader input) throws IOException { final BufferedReader reader = toBufferedReader(input); final List<String> list = new ArrayList<String>(); String line = reader.readLine(); while (line != null) { list.add(line); line = reader.readLine(); } return list; }
/** * Compares the contents of two Readers to determine if they are equal or * not, ignoring EOL characters. * <p> * This method buffers the input internally using * <code>BufferedReader</code> if they are not already buffered. * * @param input1 the first reader * @param input2 the second reader * @return true if the content of the readers are equal (ignoring EOL differences), false otherwise * @throws NullPointerException if either input is null * @throws IOException if an I/O error occurs * @since 2.2 */ public static boolean contentEqualsIgnoreEOL(final Reader input1, final Reader input2) throws IOException { if (input1 == input2) { return true; } final BufferedReader br1 = toBufferedReader(input1); final BufferedReader br2 = toBufferedReader(input2); String line1 = br1.readLine(); String line2 = br2.readLine(); while (line1 != null && line2 != null && line1.equals(line2)) { line1 = br1.readLine(); line2 = br2.readLine(); } return line1 == null ? line2 == null ? true : false : line1.equals(line2); }
/** * Get the contents of a <code>Reader</code> as a list of Strings, * one entry per line. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input the <code>Reader</code> to read from, not null * @return the list of Strings, never null * @throws NullPointerException if the input is null * @throws IOException if an I/O error occurs * @since 1.1 */ public static List<String> readLines(Reader input) throws IOException { BufferedReader reader = toBufferedReader(input); List<String> list = new ArrayList<String>(); String line = reader.readLine(); while (line != null) { list.add(line); line = reader.readLine(); } return list; }
/** * Gets the contents of a <code>Reader</code> as a list of Strings, * one entry per line. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input the <code>Reader</code> to read from, not null * @return the list of Strings, never null * @throws NullPointerException if the input is null * @throws IOException if an I/O error occurs * @since 1.1 */ public static List<String> readLines(final Reader input) throws IOException { final BufferedReader reader = toBufferedReader(input); final List<String> list = new ArrayList<>(); String line = reader.readLine(); while (line != null) { list.add(line); line = reader.readLine(); } return list; }
/** * Compares the contents of two Readers to determine if they are equal or * not, ignoring EOL characters. * <p> * This method buffers the input internally using * <code>BufferedReader</code> if they are not already buffered. * * @param input1 the first reader * @param input2 the second reader * @return true if the content of the readers are equal (ignoring EOL differences), false otherwise * @throws NullPointerException if either input is null * @throws IOException if an I/O error occurs * @since 2.2 */ public static boolean contentEqualsIgnoreEOL(final Reader input1, final Reader input2) throws IOException { if (input1 == input2) { return true; } final BufferedReader br1 = toBufferedReader(input1); final BufferedReader br2 = toBufferedReader(input2); String line1 = br1.readLine(); String line2 = br2.readLine(); while (line1 != null && line2 != null && line1.equals(line2)) { line1 = br1.readLine(); line2 = br2.readLine(); } return line1 == null ? line2 == null ? true : false : line1.equals(line2); }
private boolean isCorrectVCF(XWikiAttachment attachment, String eid, XWikiContext context) throws XWikiException, IOException { BufferedReader in = IOUtils.toBufferedReader(new InputStreamReader(attachment.getContentInputStream(context), XWiki.DEFAULT_ENCODING)); String line; while ((line = in.readLine()) != null) { if (line.startsWith("##")) { // Still in the meta, go on continue; } else if (!line.startsWith("#CHROM")) { // Actual data, we're past the meta but didn't encounter the header, strange... // Malformed file, abandon break; } String[] fields = line.split("\t"); if (fields.length != 10 || !StringUtils.equals(eid, fields[9])) { // Wrong sample ID or more than one sample, bail out break; } return true; } return false; } }
try { source = new StreamSource( IOUtils.toBufferedReader( new InputStreamReader( IOUtils.toInputStream(
BufferedReader bufferedReader = IOUtils.toBufferedReader(inputStreamReader); String line = bufferedReader.readLine(); while (line != null) {