mailerfile.java
来自「一个日本流行的,功能较全的开源Web办公管理(Groupware)系统。」· Java 代码 · 共 90 行
JAVA
90 行
package jp.co.sjts.gsession.main;
/*
* 屄恖忣曬僼傽僀儖 MailerFile.java
* Copyright (C) 1999-2000 Japan Total System Co,LTD
* Satoru K <koni@sjts.co.jp>
*/
import java.io.IOException;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.File;
import java.util.StringTokenizer;
import jp.co.sjts.gsession.tools.*;
public class MailerFile extends GSTextFile
{
public final String FILENAME = "mailer";
public final String MAILER = "mailer";
public static final int GSMILER = 0;
public static final int BASICMILER = 1;
private File file=null;
private int Mailer = BASICMILER;
public MailerFile(String dir)
{
File dirbuf = new File(dir);
if(!dirbuf.exists())
dirbuf.mkdirs();
file = new File(dir,FILENAME);
if(!file.exists()){
try {
Save();
} catch(GSException e) {
}
}
}
public int getMailer(){
return Mailer;
}
public void setMailer(int Mailer){
this.Mailer = Mailer;
}
protected File GetFile()
{
return file;
}
protected void Read(BufferedReader bf) throws GSException
{
try {
String buf = new String();
String label,value;
for(buf=bf.readLine();buf!=null;buf=bf.readLine())
{
StringTokenizer st = new StringTokenizer(buf,"=");
label = st.nextToken();
if(st.hasMoreTokens())
value = st.nextToken();
else
value = "";
checkStore(label,value);
}
} catch(IOException e) {
throw new GSException("\"Mailer file\"撉崬傒僄儔乕");
}
}
protected boolean checkStore(String label,String value)
{
if(label.equals(MAILER)){
if(value.length()>0)
setMailer(Integer.parseInt(value));
return true;
}
return false;
}
protected void Write(PrintWriter pw) throws GSException
{
pw.println(MAILER + "=" + Integer.toString(getMailer()));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?