01: /**
02: *
03: * edtFTPj
04: *
05: * Copyright (C) 2000-2004 Enterprise Distributed Technologies Ltd
06: *
07: * www.enterprisedt.com
08: *
09: * This library is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU Lesser General Public
11: * License as published by the Free Software Foundation; either
12: * version 2.1 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * Lesser General Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser General Public
20: * License along with this library; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: *
23: * Bug fixes, suggestions and comments should be should posted on
24: * http://www.enterprisedt.com/forums/index.php
25: *
26: * Change Log:
27: *
28: * $Log: FTPMessageCollector.java,v $
29: * Revision 1.2 2005/06/03 11:26:25 bruceb
30: * comment change
31: *
32: * Revision 1.1 2004/05/22 16:52:57 bruceb
33: * message listener
34: *
35: */package com.enterprisedt.net.ftp;
36:
37: /**
38: * Listens for and is notified of FTP commands and replies.
39: *
40: * @author Bruce Blackshaw
41: * @version $Revision: 1.2 $
42: */
43: public class FTPMessageCollector implements FTPMessageListener {
44:
45: /**
46: * Log of messages
47: */
48: private StringBuffer log = new StringBuffer();
49:
50: /**
51: * Log an FTP command being sent to the server
52: *
53: * @param cmd command string
54: */
55: public void logCommand(String cmd) {
56: log.append(cmd).append("\n");
57: }
58:
59: /**
60: * Log an FTP reply being sent back to the client
61: *
62: * @param reply reply string
63: */
64: public void logReply(String reply) {
65: log.append(reply).append("\n");
66: }
67:
68: /**
69: * Get the log of messages
70: *
71: * @return message log as a string
72: */
73: public String getLog() {
74: return log.toString();
75: }
76:
77: /**
78: * Clear the log of all messages
79: */
80: public void clearLog() {
81: log = new StringBuffer();
82: }
83:
84: }
|