%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
examples.PrintCommandListener |
|
|
1 | /* |
|
2 | * Copyright 2001-2005 The Apache Software Foundation |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | */ |
|
16 | package examples; |
|
17 | ||
18 | import java.io.PrintWriter; |
|
19 | import org.apache.commons.net.ProtocolCommandEvent; |
|
20 | import org.apache.commons.net.ProtocolCommandListener; |
|
21 | ||
22 | /*** |
|
23 | * This is a support class for some of the example programs. It is |
|
24 | * a sample implementation of the ProtocolCommandListener interface |
|
25 | * which just prints out to a specified stream all command/reply traffic. |
|
26 | * <p> |
|
27 | ***/ |
|
28 | ||
29 | public class PrintCommandListener implements ProtocolCommandListener |
|
30 | { |
|
31 | private PrintWriter __writer; |
|
32 | ||
33 | public PrintCommandListener(PrintWriter writer) |
|
34 | 0 | { |
35 | 0 | __writer = writer; |
36 | 0 | } |
37 | ||
38 | public void protocolCommandSent(ProtocolCommandEvent event) |
|
39 | { |
|
40 | 0 | __writer.print(event.getMessage()); |
41 | 0 | __writer.flush(); |
42 | 0 | } |
43 | ||
44 | public void protocolReplyReceived(ProtocolCommandEvent event) |
|
45 | { |
|
46 | 0 | __writer.print(event.getMessage()); |
47 | 0 | __writer.flush(); |
48 | 0 | } |
49 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |