MultiReader(Iterator<? extends InputSupplier<? extends Reader>> readers) throws IOException { this.it = readers; advance(); }
/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a new {@link StringBuilder} instance. * * @param supplier the factory to read from * @throws IOException if an I/O error occurs */ private static <R extends Readable & Closeable> StringBuilder toStringBuilder( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { StringBuilder result = toStringBuilder(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a new {@link StringBuilder} instance. * * @param supplier the factory to read from * @throws IOException if an I/O error occurs */ private static <R extends Readable & Closeable> StringBuilder toStringBuilder( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { StringBuilder result = toStringBuilder(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
/** * Reads the first line from a {@link Readable} & {@link Closeable} object * supplied by a factory. The line does not include line-termination * characters, but does include other leading and trailing whitespace. * * @param supplier the factory to read from * @return the first line, or null if the reader is empty * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> String readFirstLine( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { String line = new LineReader(r).readLine(); threw = false; return line; } finally { Closeables.close(r, threw); } }
/** * Reads all of the lines from a {@link Readable} & {@link Closeable} object * supplied by a factory. The lines do not include line-termination * characters, but do include other leading and trailing whitespace. * * @param supplier the factory to read from * @return a mutable {@link List} containing all the lines * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> List<String> readLines( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { List<String> result = readLines(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
/** * Reads all of the lines from a {@link Readable} & {@link Closeable} object * supplied by a factory. The lines do not include line-termination * characters, but do include other leading and trailing whitespace. * * @param supplier the factory to read from * @return a mutable {@link List} containing all the lines * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> List<String> readLines( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { List<String> result = readLines(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
/** * Reads the first line from a {@link Readable} & {@link Closeable} object * supplied by a factory. The line does not include line-termination * characters, but does include other leading and trailing whitespace. * * @param supplier the factory to read from * @return the first line, or null if the reader is empty * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> String readFirstLine( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { String line = new LineReader(r).readLine(); threw = false; return line; } finally { Closeables.close(r, threw); } }
/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a new {@link StringBuilder} instance. * * @param supplier the factory to read from * @throws IOException if an I/O error occurs */ private static <R extends Readable & Closeable> StringBuilder toStringBuilder( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { StringBuilder result = toStringBuilder(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a new {@link StringBuilder} instance. * * @param supplier the factory to read from * @throws IOException if an I/O error occurs */ private static <R extends Readable & Closeable> StringBuilder toStringBuilder( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { StringBuilder result = toStringBuilder(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
/** * Reads all of the lines from a {@link Readable} & {@link Closeable} object * supplied by a factory. The lines do not include line-termination * characters, but do include other leading and trailing whitespace. * * @param supplier the factory to read from * @return a mutable {@link List} containing all the lines * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> List<String> readLines( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { List<String> result = readLines(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
/** * Reads all of the lines from a {@link Readable} & {@link Closeable} object * supplied by a factory. The lines do not include line-termination * characters, but do include other leading and trailing whitespace. * * @param supplier the factory to read from * @return a mutable {@link List} containing all the lines * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> List<String> readLines( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { List<String> result = readLines(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
MultiReader(Iterator<? extends InputSupplier<? extends Reader>> readers) throws IOException { this.it = readers; advance(); }
/** * Reads the first line from a {@link Readable} & {@link Closeable} object * supplied by a factory. The line does not include line-termination * characters, but does include other leading and trailing whitespace. * * @param supplier the factory to read from * @return the first line, or null if the reader is empty * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> String readFirstLine( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { String line = new LineReader(r).readLine(); threw = false; return line; } finally { Closeables.close(r, threw); } }
/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a new {@link StringBuilder} instance. * * @param supplier the factory to read from * @throws IOException if an I/O error occurs */ private static <R extends Readable & Closeable> StringBuilder toStringBuilder( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { StringBuilder result = toStringBuilder(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a new {@link StringBuilder} instance. * * @param supplier the factory to read from * @throws IOException if an I/O error occurs */ private static <R extends Readable & Closeable> StringBuilder toStringBuilder( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { StringBuilder result = toStringBuilder(r); threw = false; return result; } finally { Closeables.close(r, threw); } }
MultiReader(Iterator<? extends InputSupplier<? extends Reader>> readers) throws IOException { this.it = readers; advance(); }
/** * Reads the first line from a {@link Readable} & {@link Closeable} object * supplied by a factory. The line does not include line-termination * characters, but does include other leading and trailing whitespace. * * @param supplier the factory to read from * @return the first line, or null if the reader is empty * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> String readFirstLine( InputSupplier<R> supplier) throws IOException { boolean threw = true; R r = supplier.getInput(); try { String line = new LineReader(r).readLine(); threw = false; return line; } finally { Closeables.close(r, threw); } }