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

📄 loadsmtpusers.java

📁 基于java的电子邮件群发系统,基于java的电子邮件群发系统
💻 JAVA
字号:
package com.cwq.batchmail.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;

import com.cwq.batchmail.mail.SmtpUser;

public class LoadSmtpUsers {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}
	
	public static Vector<SmtpUser> load(File f) throws IOException {
		Set<SmtpUser> users = new HashSet<SmtpUser>();
		BufferedReader in = new BufferedReader(new java.io.FileReader(f));
		String line = null;
		
		StringTokenizer tokener = null;
		while ((line = in.readLine()) != null) {
			line = line.trim();
			if(line.length() > 0) {
				try {
					tokener = new StringTokenizer(line, ";, ", false);
					users.add(new SmtpUser(
							tokener.nextToken(),
							Integer.parseInt(tokener.nextToken()),
							tokener.nextToken(),
							tokener.nextToken(),
							Integer.parseInt(tokener.nextToken())
							));
				} catch(NoSuchElementException ex) {
				} catch(NumberFormatException ex) {
				} catch(Exception ex) {
				}
			}
		}
		
		try { in.close(); } catch(Exception ex) {}
		
		return new Vector<SmtpUser>(users);
	}

}

⌨️ 快捷键说明

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