@Test public void testTailerEof() throws Exception { final long delay = 50; final File file = new File(getTestDirectory(), "tailer2-test.txt"); createFile(file, 0); final TestTailerListener listener = new TestTailerListener(); final Tailer tailer = new Tailer(file, listener, delay, false); final Thread thread = new Thread(tailer); thread.start(); final FileWriter writer = null; try { writeString(file, "Line"); TestUtils.sleep(delay * 2); List<String> lines = listener.getLines(); assertEquals("1 line count", 0, lines.size()); writeString(file, " one\n"); TestUtils.sleep(delay * 2); lines = listener.getLines(); assertEquals("1 line count", 1, lines.size()); assertEquals("1 line 1", "Line one", lines.get(0)); listener.clear(); } finally { tailer.stop(); TestUtils.sleep(delay * 2); IOUtils.closeQuietly(writer); } }
private void stop(final Exception e) { listener.handle(e); stop(); }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener);  Tailer(final File file, final TailerListener listener, final long delayMillis);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final int bufSize);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen, final int bufSize);  Tailer(final File file, final Charset cset, final TailerListener listener, final long delayMillis,
                  final boolean end, final boolean reOpen
            , final int bufSize); }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener);  Tailer(final File file, final TailerListener listener, final long delayMillis);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final int bufSize);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen, final int bufSize);  Tailer(final File file, final Charset cset, final TailerListener listener, final long delayMillis,
                  final boolean end, final boolean reOpen
            , final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final boolean reOpen,
            final int bufSize); static Tailer create(final File file, final Charset charset, final TailerListener listener,
                                final long delayMillis, final boolean end, final boolean reOpen
            ,final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final boolean reOpen); static Tailer create(final File file, final TailerListener listener, final long delayMillis); static Tailer create(final File file, final TailerListener listener); File getFile(); long getDelay(); void run(); void stop(); }
Tailer implements Runnable { private void stop(final Exception e) { listener.handle(e); stop(); } Tailer(final File file, final TailerListener listener);  Tailer(final File file, final TailerListener listener, final long delayMillis);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final int bufSize);  Tailer(final File file, final TailerListener listener, final long delayMillis, final boolean end,
                  final boolean reOpen, final int bufSize);  Tailer(final File file, final Charset cset, final TailerListener listener, final long delayMillis,
                  final boolean end, final boolean reOpen
            , final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final boolean reOpen,
            final int bufSize); static Tailer create(final File file, final Charset charset, final TailerListener listener,
                                final long delayMillis, final boolean end, final boolean reOpen
            ,final int bufSize); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end); static Tailer create(final File file, final TailerListener listener, final long delayMillis,
                                final boolean end, final boolean reOpen); static Tailer create(final File file, final TailerListener listener, final long delayMillis); static Tailer create(final File file, final TailerListener listener); File getFile(); long getDelay(); void run(); void stop();  }