blmainconffile.java
来自「一个日本流行的,功能较全的开源Web办公管理(Groupware)系统。」· Java 代码 · 共 91 行
JAVA
91 行
package jp.co.sjts.gsession.bulletin;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import jp.co.sjts.gsession.tools.*;
/**
* <p>宖帵斅偺婎杮愝掕僼傽僀儖娗棟梡
*
* @author Masakatu O <ookubo@sjts.co.jp>
* @author Satoru K <koni@sjts.co.jp>
*/
public class BLMainConfFile extends GSTextFile{
/** 宖帵斅ID嵟廔抣 */
private int BulletinMax;
/** */
public synchronized int GetBulletinMax() { return BulletinMax; }
/** */
public synchronized String GetStrBullMax() { return Integer.toString(BulletinMax); }
/** */
public synchronized void SetBulletinMax(int bulletinmax) { BulletinMax = bulletinmax; }
/** */
public synchronized void SetBulletinMax(String bulletinmax) { BulletinMax = Integer.parseInt(bulletinmax); }
/** */
private File file;
/**
* <p>僐儞僗僩儔僋僞
*/
public BLMainConfFile(String BulletinDir) throws GSException{
String filePath = BulletinDir + BLCmd.USERFILENAME;
this.file = new File(filePath);
if(!file.exists()) { // 僼傽僀儖偑側偄応崌偼丄僨僼僅儖僩抣偱嶌惉
SetBulletinMax(0);
Save();
}
}
/**
* <p>僼傽僀儖僆僽僕僃僋僩傪庢摼偟傑偡丅
*
* @return 僼傽僀儖僆僽僕僃僋僩
*/
synchronized protected File GetFile(){
return file;
}
/**
* <p>僼傽僀儖偵儔僀僩偟傑偡丅
* <p>偙偺Write儊僜僢僪傪捈愙巊梡偡傞偙偲偼偁傝傑偣傫丅Save儊僜僢僪偐傜屇傃弌偝傟傑偡丅
* <BR>僥儞僾儗乕僩儊僜僢僪僷僞乕儞
*
* @param pw PrintWriter僆僽僕僃僋僩
*/
synchronized protected void Write(PrintWriter pw) throws GSException{
pw.println( "bulletinmax=" + GetStrBullMax() );
}
/**
* <p>僨乕僞傪撉傒崬傒傑偡丅
* <p>偙偺Read儊僜僢僪傪捈愙巊梡偡傞偙偲偼偁傝傑偣傫丅Load儊僜僢僪偐傜屇傃弌偝傟傑偡丅
* <BR>僥儞僾儗乕僩儊僜僢僪僷僞乕儞
*
* @param bf 僶僢僼傽乕儕乕僟乕
*/
synchronized protected void Read(BufferedReader bf) throws GSException{
try{
String buf = null;
for(buf=bf.readLine();buf!=null;buf=bf.readLine()) {
String value = buf.substring(buf.indexOf("=")+1);
if(buf.startsWith("bulletinmax"))
BulletinMax = Integer.parseInt(value);
}
}catch(IOException e){
throw new GSException("宖帵斉僐儞僼僼傽僀儖偺撉崬傒偵幐攕");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?