View Javadoc
1   package org.codehaus.plexus.util.cli;
2   
3   /*
4    * Copyright The Codehaus Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  /********************************************************************************
20   * CruiseControl, a Continuous Integration Toolkit
21   * Copyright (c) 2003, ThoughtWorks, Inc.
22   * 651 W Washington Ave. Suite 500
23   * Chicago, IL 60661 USA
24   * All rights reserved.
25   *
26   * Redistribution and use in source and binary forms, with or without
27   * modification, are permitted provided that the following conditions
28   * are met:
29   *
30   *     + Redistributions of source code must retain the above copyright
31   *       notice, this list of conditions and the following disclaimer.
32   *
33   *     + Redistributions in binary form must reproduce the above
34   *       copyright notice, this list of conditions and the following
35   *       disclaimer in the documentation and/or other materials provided
36   *       with the distribution.
37   *
38   *     + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the
39   *       names of its contributors may be used to endorse or promote
40   *       products derived from this software without specific prior
41   *       written permission.
42   *
43   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
47   * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
48   * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
49   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
50   * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
51   * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
52   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
53   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54   ********************************************************************************/
55  
56  import java.io.IOException;
57  
58  /**
59   * Works in concert with the StreamPumper class to allow implementations to gain access to the lines being "Pumped".
60   * Please note that implementations of this interface can be expected to be called from arbitrary threads and must
61   * therefore be threadsafe.
62   *
63   * @author <a href="mailto:fvancea@maxiq.com">Florin Vancea</a>
64   * @author <a href="mailto:pj@thoughtworks.com">Paul Julius</a>
65   * @version $Id$
66   */
67  public interface StreamConsumer
68  {
69      /**
70       * Called when the StreamPumper pumps a line from the Stream.
71       * 
72       * @param line The line to be consumed.
73       * @throws IOException if consuming {@code line} fails.
74       */
75      public void consumeLine( String line )
76          throws IOException;
77  }