home *** CD-ROM | disk | FTP | other *** search
- package com.zerog.util;
-
- import java.io.IOException;
- import java.io.InputStream;
-
- public class QuotedStreamTokenizer {
- // $FF: renamed from: in java.io.InputStream
- private InputStream field_0;
- private char quoteChar = '"';
- private char delimiter = ' ';
- private boolean delimiting = true;
- private int type = -1;
- public static final int NOTHING = -1;
- public static final int WORDS = -10;
- public static final int FULL_QUOTED = -11;
- public static final int HALF_QUOTED = -12;
- private boolean drained = false;
- private boolean quoting = false;
-
- public QuotedStreamTokenizer(InputStream var1) {
- new Integer(4);
- new StringBuffer();
- this.field_0 = var1;
- }
-
- public int getType() {
- new Integer(4);
- new StringBuffer();
- return this.type;
- }
-
- public void setQuoteChar(char var1) {
- new Integer(4);
- new StringBuffer();
- this.quoteChar = var1;
- }
-
- public char getQuoteChar() {
- new Integer(4);
- new StringBuffer();
- return this.quoteChar;
- }
-
- public void setDelimiter(char var1) {
- new Integer(4);
- new StringBuffer();
- this.delimiter = var1;
- }
-
- public char getDelimiter() {
- new Integer(4);
- new StringBuffer();
- return this.delimiter;
- }
-
- public boolean isDelimiting() {
- new Integer(4);
- new StringBuffer();
- return this.delimiting;
- }
-
- public void setDelimiting(boolean var1) {
- new Integer(4);
- new StringBuffer();
- this.delimiting = var1;
- }
-
- public String getNextToken() {
- new Integer(4);
- new StringBuffer();
- StringBuffer var1 = new StringBuffer();
- boolean var2 = false;
- if (this.drained) {
- this.type = -1;
- return null;
- } else {
- int var3;
- try {
- while((var3 = this.field_0.read()) != -1) {
- if (var3 == 92) {
- if (var2) {
- var1.append("\\");
- var2 = false;
- } else {
- var2 = true;
- }
- } else if (var3 == this.quoteChar) {
- if (var2) {
- var1.append("\"");
- var2 = false;
- } else {
- if (this.quoting) {
- this.type = -11;
- this.quoting = false;
- return var1.toString();
- }
-
- this.quoting = true;
- if (var1.length() > 0) {
- this.type = -10;
- return var1.toString();
- }
- }
- } else if (this.isDelimiting() && var3 == this.delimiter && !this.quoting) {
- if (var2) {
- var1.append("\\");
- var2 = false;
- }
-
- if (var1.length() > 0) {
- this.type = -10;
- return var1.toString();
- }
- } else {
- if (var2) {
- var1.append("\\");
- var2 = false;
- }
-
- var1.append(String.valueOf((char)var3));
- }
- }
- } catch (IOException var5) {
- ((Throwable)var5).printStackTrace();
- }
-
- this.drained = true;
- if (this.quoting) {
- this.type = -12;
- } else {
- this.type = -10;
- }
-
- return var1.length() > 0 ? var1.toString() : null;
- }
- }
-
- public void close() {
- new Integer(4);
- new StringBuffer();
- if (this.field_0 != null) {
- try {
- this.field_0.close();
- } catch (IOException var2) {
- ((Throwable)var2).printStackTrace();
- }
- }
-
- }
- }
-