⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filefoundevent.java

📁 一个简易的轮训小程序 哈哈哈哈哈哈后 嘿嘿嘿嘿黑诶
💻 JAVA
字号:
package org.sadun.util.polling;

import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Indicates that the poller has found a file. Note that an {@link FileSetFoundEvent
 * FileSetFoundEvent} containing the same file is always notified before this.
 *
 * <p>This event is signalled only if the {@link DirectoryPoller DirectoryPoller}
 * returns <b>true</b> when invoking {@link DirectoryPoller#isSendSingleFileEvent()
 * isSendSingleFileEvent()}.
 *
 * @version 1.0
 * @author C. Sadun
 */
public class FileFoundEvent extends BaseDirectoryEvent {

    private File file;
    private static DateFormat df = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");

    FileFoundEvent(DirectoryPoller poller, File file) {
        super(poller, file.getParentFile());
        this.file=file;
    }

    public File getFile() { return file; }
    
    public String toString() {
        return "File found in: " + getDirectory().getAbsolutePath() + ": "
                + file.getName() + ", size: "+(int)(file.length()/1024)+"K ,mod. "
                + df.format(new Date(file.lastModified()));
    }
}
    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -