/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a {@link String}. * * @param supplier the factory to read from * @return a string containing all the characters * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> String toString( InputSupplier<R> supplier) throws IOException { return toStringBuilder(supplier).toString(); }
/** * Reads all characters from a {@link Readable} object into a {@link String}. * Does not close the {@code Readable}. * * @param r the object to read from * @return a string containing all the characters * @throws IOException if an I/O error occurs */ public static String toString(Readable r) throws IOException { return toStringBuilder(r).toString(); }
/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a {@link String}. * * @param supplier the factory to read from * @return a string containing all the characters * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> String toString( InputSupplier<R> supplier) throws IOException { return toStringBuilder(supplier).toString(); }
/** * Reads all characters from a {@link Readable} object into a {@link String}. * Does not close the {@code Readable}. * * @param r the object to read from * @return a string containing all the characters * @throws IOException if an I/O error occurs */ public static String toString(Readable r) throws IOException { return toStringBuilder(r).toString(); }
/** * Reads all characters from a {@link Readable} object into a {@link String}. * Does not close the {@code Readable}. * * @param r the object to read from * @return a string containing all the characters * @throws IOException if an I/O error occurs */ public static String toString(Readable r) throws IOException { return toStringBuilder(r).toString(); }
/** * Returns the characters from a {@link Readable} & {@link Closeable} object * supplied by a factory as a {@link String}. * * @param supplier the factory to read from * @return a string containing all the characters * @throws IOException if an I/O error occurs */ public static <R extends Readable & Closeable> String toString( InputSupplier<R> supplier) throws IOException { return toStringBuilder(supplier).toString(); }
/** * 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); } }
/** * 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); } }