?? maildirfoldersummary.java
字號(hào):
/**
* MaildirFolderSummary.java
* Copyright (C) 1999 fengyun <fengyun@gbsource.net>
*/
package fengyun.Fastmail.Maildir;
import java.io.File;
import java.io.FilenameFilter;
import javax.mail.MessagingException;
import fengyun.Fastmail.util.DU;
/**
* MaildirFolder摘要
* @author fengyun
* @version 1.00
*/
public class MaildirFolderSummary {
protected File folderdir = null; //郵件夾對(duì)應(yīng)的目錄
// protected String viewname = null; //界面上顯示的郵件夾名稱
protected boolean open = false; //是否打開
protected int count = 0; //消息總數(shù)
protected int newmesscount = 0; //新消息總數(shù)
protected int type = this.HOLDS_FOLDERS; //郵件夾類型
public static final int HOLDS_FOLDERS = 0; //郵件夾允許有子郵件夾
public static final int UNHOLDS_FOLDERS = 1; //不能擁有子郵夾
/**
* 構(gòu)造
* @param folderdir 郵件夾絕對(duì)路徑
*/
public MaildirFolderSummary(File folderdir) throws MessagingException {
if (folderdir!=null && folderdir.exists() && folderdir.isDirectory()) this.folderdir = folderdir;
else new MessagingException("ERROR FOLDER DIRECTORY");
}
/**
* 返回郵件夾名稱
* @return String 郵件夾名稱
*/
public String getName() {
return folderdir.getName();
}
/**
* 返回郵件夾顯示的名稱
* @return String 郵件夾顯示名稱
*/
// public String getViewName() {
// return viewname;
// }
/**
* 返回郵件夾絕對(duì)路徑
* @return String 郵件夾絕對(duì)路徑
*/
public String getFullName() {
return folderdir.getAbsolutePath();
}
/**
* 郵件夾是否打開
* @return boolean 是否打開
*/
public boolean isOpen() {
return open;
}
/**
* 郵件總數(shù)
* @return int 郵件總數(shù)
*/
public int getMessageCount() {
return count;
}
/**
* 新郵件總數(shù)
* @return int 新郵件總數(shù)
*/
public int getNewMessageCount() {
return newmesscount;
}
/**
* 返回郵件夾類型
* @return int 郵件夾類型
*/
public int getType() {
return type;
}
/**
* 返回郵件夾大小
*/
public long getSize() {
return DU.getSize(folderdir);
}
/**
* 打開
*/
public void Open() {
this.open = true;
}
/**
* 關(guān)閉
*/
public void Close() {
this.open = false;
}
/**
* 設(shè)置消息總數(shù)
* @param count 消息總數(shù)
*/
public void setMessageCount(int count) {
this.count = count;
}
/**
* 設(shè)置新消息總數(shù)
* @param newmesscount 新消息總數(shù)
*/
public void setNewMessageCount(int newmesscount) {
this.newmesscount = newmesscount;
}
/**
* 設(shè)置類型
* @param type 新類型
*/
public void setType(int type) {
this.type = type;
}
/**
* 設(shè)置郵件夾顯示名稱
* @param viewname 顯示名稱
*/
// public void setViewName(String viewname) {
// this.viewname = viewname;
// }
/**
* 郵件夾是否存在
* @return boolean 是否存在
*/
public boolean exists() {
return folderdir.exists();
}
/**
* 郵件夾列表
* @param filter 過濾器
* @return String[] 對(duì)應(yīng)的文件列表
*/
public String[] list(FilenameFilter filter) {
return folderdir.list(filter);
}
/**
* 消息數(shù)加一
*/
public void incMessageCount() {
this.count ++;
}
/**
* 消息數(shù)減一
*/
public void decMessageCount() {
this.count --;
}
/**
* 新消息加一
*/
public void incNewMessageCount() {
this.newmesscount ++;
}
/**
* 新消息減一
*/
public void decNewMessageCount() {
this.newmesscount --;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -