home *** CD-ROM | disk | FTP | other *** search
- package com.sfs.net;
-
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.Enumeration;
- import java.util.StringTokenizer;
- import java.util.Vector;
-
- public class StreamParser implements Enumeration {
- public static final String TOKEN_BREAK = "┬░";
- BufferedReader dis;
- Vector args;
-
- public Object nextElement() {
- return this.args;
- }
-
- public boolean hasMoreElements() {
- try {
- while(true) {
- String var1;
- if ((var1 = this.dis.readLine()) != null) {
- this.args = this.parseLine(var1);
- if (this.args == null) {
- continue;
- }
- }
-
- if (var1 != null && this.args != null) {
- break;
- }
-
- this.dis.close();
- return false;
- }
- } catch (IOException var4) {
- System.out.println("IOException: " + var4);
- }
-
- return true;
- }
-
- public StreamParser(URL var1) throws IOException {
- try {
- this.dis = new BufferedReader(new InputStreamReader(var1.openStream()));
- } catch (MalformedURLException var4) {
- System.out.println("MalformedURLException: " + var4);
- } catch (IOException var5) {
- System.out.println("IOException: " + var5);
- }
- }
-
- Vector parseLine(String var1) {
- if (!var1.startsWith("//") && !var1.equals("")) {
- StringTokenizer var2 = new StringTokenizer(var1, "┬░");
- Vector var3 = new Vector();
-
- while(var2.hasMoreTokens()) {
- var3.addElement(var2.nextToken());
- }
-
- return var3.size() == 0 ? null : var3;
- } else {
- return null;
- }
- }
- }
-