本文整理汇总了Java中org.apache.commons.net.ProtocolCommandEvent类的典型用法代码示例。如果您正苦于以下问题:Java ProtocolCommandEvent类的具体用法?Java ProtocolCommandEvent怎么用?Java ProtocolCommandEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProtocolCommandEvent类属于org.apache.commons.net包,在下文中一共展示了ProtocolCommandEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: protocolCommandSent
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
@Override
public void protocolCommandSent(
ProtocolCommandEvent event ) {
/* because we can only pause a file upload, we check if the event has a STOR command */
if (event.getCommand().equals(FTPCmd.STOR.getCommand())) {
// Check only progress events so the transfer be paused when the
// transfer is taking place not before or after it.
log.debug("Progress event #" + (currentProgessEvent));
if (currentProgessEvent++ == progressEventNumber && Thread.holdsLock(owner)) {
try {
log.debug("Waiting for the transfer to be resumed...");
// Release the monitor and wait to be notified to continue the transfer.
owner.wait();
} catch (InterruptedException e) {
log.error("Transfer thread interrupted while paused. Continue transfer.", e);
}
}
}
}
示例2: protocolCommandSent
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
public void protocolCommandSent(ProtocolCommandEvent event) {
final StringBuilder sb = new StringBuilder("> ");
String cmd = event.getCommand();
if(!"PASS".equalsIgnoreCase(cmd) && !"USER".equalsIgnoreCase(cmd)) {
if("LOGIN".equalsIgnoreCase(cmd)) {
String msg = event.getMessage();
msg = msg.substring(0, msg.indexOf("LOGIN") + "LOGIN".length());
sb.append(msg).append(" *******");
} else {
sb.append(event.getMessage());
}
} else {
sb.append(cmd).append(" *******");
}
logInternalMessage(sb.toString());
}
示例3: protocolCommandSent
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
@Override
public void protocolCommandSent(final ProtocolCommandEvent event) {
final String message = StringUtils.chomp(event.getMessage());
if(message.startsWith(FTPCmd.PASS.name())) {
this.log(Type.request, String.format("%s %s", FTPCmd.PASS.name(),
StringUtils.repeat("*", StringUtils.length(StringUtils.removeStart(message, FTPCmd.PASS.name())))));
}
else {
this.log(Type.request, message);
}
}
示例4: protocolCommandSent
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
public void protocolCommandSent(ProtocolCommandEvent event) {
try {
__logIt(event);
} catch (IOException e) {
if (__logger.isInfoEnabled()) {
__logger.info("PrintCommandListener.protocolCommandSent(): " + e);
}
}
}
示例5: protocolReplyReceived
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
public void protocolReplyReceived(ProtocolCommandEvent event) {
try {
__logIt(event);
} catch (IOException e) {
if (__logger.isInfoEnabled()) {
__logger.info("PrintCommandListener.protocolReplyReceived(): " + e);
}
}
}
示例6: __logIt
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
private void __logIt(ProtocolCommandEvent event) throws IOException {
if (!__logger.isInfoEnabled()) {
return;
}
BufferedReader br = new BufferedReader(new StringReader(event.getMessage()));
String line;
while ((line = br.readLine()) != null) {
__logger.info("ftp> " + line);
}
}
示例7: fireCommandSent
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
public void fireCommandSent(String command, String message) {
ProtocolCommandEvent event = new ProtocolCommandEvent(this.__source, command, message);
Iterator var5 = this.__listeners.iterator();
while(var5.hasNext()) {
EventListener listener = (EventListener)var5.next();
((ProtocolCommandListener)listener).protocolCommandSent(event);
}
}
示例8: fireReplyReceived
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
public void fireReplyReceived(int replyCode, String message) {
ProtocolCommandEvent event = new ProtocolCommandEvent(this.__source, replyCode, message);
Iterator var5 = this.__listeners.iterator();
while(var5.hasNext()) {
EventListener listener = (EventListener)var5.next();
((ProtocolCommandListener)listener).protocolReplyReceived(event);
}
}
示例9: protocolCommandSent
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
public void protocolCommandSent(ProtocolCommandEvent event) {
try {
__logIt(event);
} catch (IOException e) {
if (__logger.isInfoEnabled()) {
__logger.info("PrintCommandListener.protocolCommandSent(): "+e);
}
}
}
示例10: protocolReplyReceived
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
public void protocolReplyReceived(ProtocolCommandEvent event) {
try {
__logIt(event);
} catch (IOException e) {
if (__logger.isInfoEnabled()) {
__logger.info("PrintCommandListener.protocolReplyReceived(): "+e);
}
}
}
示例11: __logIt
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
private void __logIt(ProtocolCommandEvent event) throws IOException {
if (!__logger.isInfoEnabled()) { return; }
BufferedReader br =
new BufferedReader(new StringReader(event.getMessage()));
String line;
while ((line = br.readLine()) != null) {
__logger.info("ftp> "+line);
}
}
示例12: protocolReplyReceived
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
@Override
public void protocolReplyReceived(
ProtocolCommandEvent event ) {
}
示例13: protocolCommandSent
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
@Override
public void protocolCommandSent(
ProtocolCommandEvent event ) {
}
示例14: protocolReplyReceived
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
@Override
public void protocolReplyReceived(final ProtocolCommandEvent event) {
this.log(Type.response, StringUtils.chomp(event.getMessage()));
}
示例15: protocolReplyReceived
import org.apache.commons.net.ProtocolCommandEvent; //导入依赖的package包/类
public void protocolReplyReceived(ProtocolCommandEvent event) {
logInternalMessage("< " + event.getMessage());
}