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

📄 ciuserconffile.java

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

/*
 * Circular 偺XXXX  CIUserConfFile.java
 * Copyright (C) 1999-2000 Japan Total System Co,LTD
 *	  Masakatu O	<ookubo@sjts.co.jp>
 */

import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Properties;
import java.util.StringTokenizer;
import jp.co.sjts.gsession.tools.*;

public class CIUserConfFile extends GSTextFile
{
	private int Display;		// 夞棗斅侾儁乕僕昞帵峴悢
	private int Direct;			// 夞棗愭僌儖乕僾ID嵟廔抣

	private int[] ken = {10,20,30,40,50} ;		// 侾儁乕僕昞帵峴悢

	/**
	 * <P>夞棗斅侾儁乕僕昞帵峴悢傪曉偟傑偡丅
	 *
	 * @return 夞棗斅侾儁乕僕昞帵峴悢
	 */
	public synchronized int GetDisplay() { return Display; }
	/**
	 * <P>夞棗斅侾儁乕僕昞帵峴悢偺嵟戝抣傪曉偟傑偡丅
	 *
	 * @return 夞棗斅侾儁乕僕昞帵峴悢
	 */
	public synchronized int GetDisplayMax() { return ken[Display]; }
	/**
	 * <P>夞棗愭僌儖乕僾ID嵟廔抣傪曉偟傑偡丅
	 *
	 * @return 夞棗愭僌儖乕僾ID嵟廔抣
	 */
	public synchronized int GetDirect() { return Direct; }

	/**
	 * <P>夞棗斅侾儁乕僕昞帵峴悢傪巜掕偝傟偨抣偵愝掕偟傑偡丅
	 *
	 * @param display - 夞棗斅侾儁乕僕昞帵峴悢
	 */
	public synchronized void SetDisplay(int display) { Display = display; }
	/**
	 * <P>夞棗斅侾儁乕僕昞帵峴悢傪巜掕偝傟偨抣偵愝掕偟傑偡丅
	 *
	 * @param display - 夞棗斅侾儁乕僕昞帵峴悢
	 */
	public synchronized void SetDisplay(String display) { Display = Integer.parseInt(display); }
	/**
	 * <P>夞棗愭僌儖乕僾ID嵟廔抣傪巜掕偝傟偨抣偵愝掕偟傑偡丅
	 *
	 * @param direct - 夞棗愭僌儖乕僾ID嵟廔抣
	 */
	public synchronized void SetDirect(int direct) { Direct = direct; }
	/**
	 * <P>夞棗愭僌儖乕僾ID嵟廔抣傪巜掕偝傟偨抣偵愝掕偟傑偡丅
	 *
	 * @param display - 夞棗愭僌儖乕僾ID嵟廔抣
	 */
	public synchronized void SetDirect(String direct) { Direct = Integer.parseInt(direct); }

	public final static String FILENAME = File.separator + "configure";
	public final static String DIR = "user" + File.separator ;
	
	private Properties properties=null;

	private File file;

	/**
	 * <P>巜掕偝傟偨抣傪尦偵僆僽僕僃僋僩傪惗惉偡傞丅
	 *
	 * @param HomeDir - 夞棗斅僨乕僞僨傿儗僋僩儕
	 * @param UserId - 儐乕僓乕ID
	 */
	public CIUserConfFile(String HomeDir,String UserId) throws GSException
	{
		properties = System.getProperties();
		String UserDir = HomeDir + DIR + UserId ;
		UserDir = UserDir.replace('/',this.properties.getProperty("file.separator").charAt(0));

		File file1 = new File(UserDir);

		if(!file1.exists())		// 僼傽僀儖偑懚嵼偡傞偐
			file1.mkdirs();		// 僼傽僀儖偑懚嵼偟側偄応崌偼丄嶌惉傪帋傒傞

		String filePath = UserDir + FILENAME;
		this.file = new File(filePath);

		if(!file.exists()) {		// 僼傽僀儖偑側偄応崌偼丄僨僼僅儖僩抣偱嶌惉
			SetDisplay(0);
			SetDirect(0);
			Save();
		}
	}

//昁偢偄傞
	synchronized protected File GetFile()
	{
		return file;
	}


	synchronized protected void Write(PrintWriter pw) throws GSException
	{
		pw.println("displaymax=" + Integer.toString(GetDisplay()));
		pw.println("directmax=" + Integer.toString(GetDirect()));
	}


	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("displaymax"))
					SetDisplay(value);
				if(buf.startsWith("directmax"))
					SetDirect(value);
			}
		}catch(IOException e){
			throw new GSException("夞棗斉儐乕僓乕僐儞僼僼傽僀儖偺撉崬傒偵幐攕");
		}
	}


}

⌨️ 快捷键说明

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