View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.io.input;
18  
19  /**
20   * {@link TailerListener} Adapter.
21   *
22   * @since 2.0
23   */
24  public class TailerListenerAdapter implements TailerListener {
25  
26      /**
27       * Constructs a new instance.
28       */
29      public TailerListenerAdapter() {
30          // empty
31      }
32  
33      /**
34       * Called each time the Tailer reaches the end of the file.
35       *
36       * <strong>Note:</strong> this is called from the tailer thread.
37       *
38       * Note: a future version of commons-io will pull this method up to the TailerListener interface,
39       * for now clients must subclass this class to use this feature.
40       *
41       * @since 2.5
42       */
43      public void endOfFileReached() {
44          // noop
45      }
46  
47      /**
48       * This method is called if the tailed file is not found.
49       */
50      @Override
51      public void fileNotFound() {
52          // noop
53      }
54  
55      /**
56       * Called if a file rotation is detected.
57       *
58       * This method is called before the file is reopened, and fileNotFound may
59       * be called if the new file has not yet been created.
60       */
61      @Override
62      public void fileRotated() {
63          // noop
64      }
65  
66      /**
67       * Handles an Exception.
68       *
69       * @param ex the exception.
70       */
71      @Override
72      public void handle(final Exception ex) {
73          // noop
74      }
75  
76      /**
77       * Handles a line from a Tailer.
78       *
79       * @param line the line.
80       */
81      @Override
82      public void handle(final String line) {
83          // noop
84      }
85  
86      /**
87       * The tailer will call this method during construction,
88       * giving the listener a method of stopping the tailer.
89       *
90       * @param tailer the tailer.
91       */
92      @Override
93      public void init(final Tailer tailer) {
94          // noop
95      }
96  }