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

📄 scconfuserfile.java

📁 一个日本流行的,功能较全的开源Web办公管理(Groupware)系统。
💻 JAVA
字号:
package jp.co.sjts.gsession.schedule;

/*
 * Schedule 偺XXXX  SCConfUserFile.java
 * Copyright (C) 1999-2000 Japan Total System Co,LTD
 *
 */

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 java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collections;

import jp.co.sjts.gsession.tools.*;
import java.util.Properties;

public class SCConfUserFile extends GSTextFile{

	private int Schemax=0;			// 僗働僕儏乕儖ID嵟廔抣
	private int Msgmax=0;				// 儊僢僙乕僕ID嵟廔抣
	private String FromTime="9";			// 奐巒帪崗
	private String ToTime="18";				// 廔椆帪崗
	private String Shozai="0";				// 嵼愋丒奜弌


	//
	public final static String FILENAME = "configure";
	private File file;

	public SCConfUserFile(String userOrGroupDir,String uid) throws GSException
	{
		// 僨傿儗僋僩儕偺桳岠惈傪僠僃僢僋
		File dir=null;

		try{
			dir = new File(userOrGroupDir,uid);

			if(!dir.exists())	      // 僼傽僀儖偑懚嵼偡傞偐
			{
				if(!dir.mkdirs())      // 僼傽僀儖偑懚嵼偟側偄応崌偼丄嶌惉傪帋傒傞
					throw new GSException("僨傿儗僋僩儕嶌惉偵帋傒偨偑幐攕偟傑偟偨丅");
			}

		} catch (SecurityException e) {
			throw new GSException("傾僋僙僗尃僄儔乕:"+dir);
		}
		this.file = new File(dir,FILENAME);
		
		if(!file.exists()){// 僼傽僀儖偑側偄応崌偼丄僨僼僅儖僩抣偱嶌惉
			// 僨僼僅儖僩抣愝掕
			Save();
		} else {
			Load();
		}
	}

	public synchronized File GetFile() {
		return file;
	}

	public synchronized int GetSchemax() { return Schemax; }
	public synchronized int GetMsgmax() { return  Msgmax; }
	public synchronized String GetFromTime() { return FromTime; }
	public synchronized String GetToTime() { return  ToTime; }
	public synchronized String GetShozai() { return  Shozai; }

	public synchronized void SetSchemax(int schemax) { Schemax = schemax; }
	public synchronized void SetMsgmax(int msgmax) { Msgmax = msgmax; }
	public synchronized void SetFromTime(String fromtime) {	FromTime = fromtime; }
	public synchronized void SetToTime(String totime) { ToTime = totime; }
	public synchronized void SetShozai(String shozai) { Shozai = shozai; }

	public synchronized void Write(PrintWriter pw) throws GSException {
			pw.println("schemax=" + GetSchemax());
			pw.println("msgmax=" + GetMsgmax());
			pw.println("fromtime=" + GetFromTime());
			pw.println("totime=" + GetToTime());
			pw.println("shozai=" + GetShozai());
	}

	public synchronized 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("schemax"))
					SetSchemax(Integer.parseInt(value));
				if(buf.startsWith("msgmax"))
					SetMsgmax(Integer.parseInt(value));
				if(buf.startsWith("fromtime"))
					SetFromTime(value);
				if(buf.startsWith("totime"))
					SetToTime(value);
				if(buf.startsWith("shozai"))
					SetShozai(value);
			}
		}catch(IOException e){
			throw new GSException("僗働僕儏乕儖儐乕僓僐儞僼僼傽僀儖偺撉崬傒偵幐攕");
		}
	}

}

⌨️ 快捷键说明

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