wkmainconffile.java
来自「一个日本流行的,功能较全的开源Web办公管理(Groupware)系统。」· Java 代码 · 共 105 行
JAVA
105 行
package jp.co.sjts.gsession.work;
/*
* Work 偺XXXX WKMainConfFile.java
* Copyright (C) 1999-2000 Japan Total System Co,LTD
* Masakatu O <ookubo@sjts.co.jp>
*/
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.*;
public class WKMainConfFile extends GSTextFile
{
private int NoteMax; // 彂椶ID偺嵟廔抣
private int Warning; // 寈崘奐巒擔
private int FolderMax; // 姰椆僼僅儖僟乕ID偺嵟廔抣
private int Display; // 儚乕僋僼儘乕侾儁乕僕昞帵峴悢
public synchronized int GetNoteMax() { return NoteMax; }
public synchronized String GetStrNoteMax() { return Integer.toString(NoteMax); }
public synchronized int GetWarning() { return Warning; }
public synchronized String GetStrWarning() { return Integer.toString(Warning); }
public synchronized int GetFolderMax() { return FolderMax; }
public synchronized String GetStrFolderMax() { return Integer.toString(FolderMax); }
public synchronized int GetDisplay() { return Display; }
public synchronized String GetStrDisplay() { return Integer.toString(Display); }
public synchronized void SetNoteMax(int notemax) { NoteMax = notemax; }
public synchronized void SetNoteMax(String notemax) { NoteMax = Integer.parseInt(notemax); }
public synchronized void SetWarning(int warning) { Warning = warning; }
public synchronized void SetWarning(String warning) { Warning = Integer.parseInt(warning); }
public synchronized void SetFolderMax(int foldermax) { FolderMax = foldermax; }
public synchronized void SetFolderMax(String foldermax) { FolderMax = Integer.parseInt(foldermax); }
public synchronized void SetDisplay(int display) { Display = display; }
public synchronized void SetDisplay(String display) { Display = Integer.parseInt(display); }
public final static String FILENAME = "configure";
private File file;
public WKMainConfFile(String HomeDir) throws GSException
{
String filePath = HomeDir + FILENAME;
this.file = new File(filePath);
if(!file.exists()) { // 僼傽僀儖偑側偄応崌偼丄僨僼僅儖僩抣偱嶌惉
SetNoteMax(0);
SetWarning(0);
SetFolderMax(0);
SetDisplay(0);
Save();
}
}
//昁偢偄傞
synchronized protected File GetFile()
{
return file;
}
//昁偢偄傞
synchronized protected void Write(PrintWriter pw) throws GSException
{
pw.println("notemax=" + GetStrNoteMax());
pw.println("warning=" + GetStrWarning());
pw.println("foldermax=" + GetStrFolderMax());
pw.println("displaymax=" + GetStrDisplay());
}
//昁偢偄傞
synchronized protected void Read(BufferedReader bf) throws GSException
{
try{
String buf;
for(buf=bf.readLine();buf!=null;buf=bf.readLine()) {
String value = buf.substring(buf.indexOf("=")+1);
if(buf.startsWith("notemax"))
SetNoteMax(value);
if(buf.startsWith("warning"))
SetWarning(value);
if(buf.startsWith("foldermax"))
SetFolderMax(value);
if(buf.startsWith("displaymax"))
SetDisplay(value);
}
}catch(IOException e){
throw new GSException("儚乕僋僼儘乕僐儞僼僼傽僀儖偺撉崬傒偵幐攕");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?