+ * To build an instance, use {@link Builder}. + *
+ * + * @see Builder + * @since 2.2 + */ +public class ReversedLinesFileReader implements Closeable { + + // @formatter:off + /** + * Builds a new {@link ReversedLinesFileReader}. + * + *+ * For example: + *
+ *{@code + * ReversedLinesFileReader r = ReversedLinesFileReader.builder() + * .setPath(path) + * .setBufferSize(4096) + * .setCharset(StandardCharsets.UTF_8) + * .get();} + *+ * + * @see #get() + * @since 2.12.0 + */ + // @formatter:on + public static class Builder extends AbstractStreamBuilder
+ * You must set input that supports {@link #getInputStream()} on this builder, otherwise, this method throws an exception. + *
+ *+ * This builder use the following aspects: + *
+ *+ * If there are less than {@code lineCount} lines in the file, then that's what + * you get. + *
+ *+ * Note: You can easily flip the result with {@link Collections#reverse(List)}. + *
+ * + * @param lineCount How many lines to read. + * @return A new list + * @throws IOException if an I/O error occurs. + * @since 2.8.0 + */ + public List+ * If there are less than {@code lineCount} lines in the file, then that's what + * you get. + *
+ * + * @param lineCount How many lines to read. + * @return A String. + * @throws IOException if an I/O error occurs. + * @since 2.8.0 + */ + public String toString(final int lineCount) throws IOException { + final List