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

📄 tempgroupeditfile.java

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

/*
 * 僌儖乕僾曇廤梡僥儞億儔儕僼傽僀儖 TempGroupEditFile.java
 * Copyright (C) 1999-2000 Japan Total System Co,LTD
 *    Satoru K  <koni@sjts.co.jp>
 */

import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Iterator;
import java.util.HashSet;
import java.util.Set;
import jp.co.sjts.gsession.tools.*;

public class TempGroupEditFile extends GSTextFile
{
	private final String FILENAME = "groupedit.tmp";

	private File file;
	private String dataDir;
	private Set adminSet;

	// 僐儞僗僩儔僋僞
	public TempGroupEditFile(String dataDir)
	{
		file = new File(dataDir,FILENAME);
		this.dataDir = dataDir;
		adminSet = new HashSet(10);
	}

	// 僥儞億儔儕僼傽僀儖偑懚嵼偡傞偐
	public boolean exists()
	{
		if(file==null)
			return false;

		return file.exists();
	}

	// 娗棟幰搊榐偝傟偰偄傞偐
	public boolean existsAdmin(int uid)
	{
		return adminSet.contains(new Integer(uid));
	}

	// 僥儞億儔儕僼傽僀儖偺嶍彍
	public void delete()
	{
		if(exists())
			file.delete();
	}

	public Iterator getAdminIterator()
	{
		return adminSet.iterator();
	}

	public int getAdminSize()
	{
		return adminSet.size();
	}

	public void addAdmin(int uid)
	{
		adminSet.add(new Integer(uid));
	}

	public void addAdmin(int[] uid)
	{
		for(int i=0;i<uid.length;i++)
			adminSet.add(new Integer(uid[i]));
	}

	public void delAdmin(int uid)
	{
		adminSet.remove(new Integer(uid));
	}

	protected File GetFile()
	{
		return file;
	}

	protected void Read(BufferedReader bf) throws GSException
	{
		// 弶婜壔
		adminSet.clear();

		try {
			String buf;
			for(buf = bf.readLine();buf!=null;buf = bf.readLine())
			{
				adminSet.add(new Integer(buf));
			}
		} catch(IOException e) {
			throw new GSException("僥儞億儔儕僼傽僀儖偺撉崬傒偵幐攕",e);
		}
	}

	protected void Write(PrintWriter pw) throws GSException
	{
		Iterator it = adminSet.iterator();

		while(it.hasNext())
		{
			Integer i = (Integer)it.next();
			pw.println(i.toString());
		}
	}
}

⌨️ 快捷键说明

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