mDelimeters = token.substring(11);
mDelimiters = token.substring(11);
	public TextfileDataset(String filename, String extras, String []geometryFieldNames)		throws FileNotFoundException, IOException, MapyrusException	{		String header, fieldType;		StringTokenizer st;		Vector v;		int i, j;		Integer fType;		String token;		boolean foundGeometryField;		String fieldNames = null, fieldTypes = null;		String startLine;		String nextLine;		/*		 * Check if we should start a program and read its output instead		 * of just reading from a file.		 */		if (filename.endsWith("|"))		{		}		mReader = new LineNumberReader(new BufferedReader(new FileReader(filename)));		mFilename = filename;		/*		 * Set default options.  Then see if user wants to override any of them.		 */		mDelimeters = null;		mComment = "#";		startLine = null;		st = new StringTokenizer(extras);		while (st.hasMoreTokens())		{			token = st.nextToken();			if (token.startsWith("comment="))				mComment = token.substring(8);			else if (token.startsWith("delimiters="))				mDelimeters = token.substring(11);			else if (token.startsWith("fieldnames="))				fieldNames = token;			else if (token.startsWith("fieldtypes="))				fieldTypes = token;			else if (token.startsWith("startline="))				startLine = token;		}				/*		 * If field names and types not given then read them from first two lines		 * of file.  Then skip more lines until we get to start of data.		 */		mSkipLines = 0;		if (fieldNames == null)		{			fieldNames = readLine();			if (fieldNames == null)				throw new MapyrusException("Unexpected end of file in '" + filename + "'");			mSkipLines++;		}		if (fieldTypes == null)		{			fieldTypes = readLine();			if (fieldNames == null)				throw new MapyrusException("Unexpected end of file in '" + filename + "'");			mSkipLines++;		}		/*		 * Skip lines until we find the place where the real data starts.		 */		if (startLine != null)		{			do			{				nextLine = readLine();				mSkipLines++;			}			while (nextLine != null && (!nextLine.startsWith(startLine)));		}		st = createStringTokenizer(fieldNames);		v = new Vector();		while (st.hasMoreTokens())		{			v.add(st.nextToken());		}		mFieldNames = (String [])(v.toArray());				mFieldTypes = new int[mFieldNames.length];		st = createStringTokenizer(fieldTypes);		i = 0;		while (st.hasMoreTokens() && i < mFieldTypes.length)		{			fieldType = st.nextToken();			fieldType = fieldType.toLowerCase();			fType = (Integer)mFieldTypeLookup.get(fieldType);			if (fType == null)				mFieldTypes[i] = Argument.STRING;			else				mFieldTypes[i] = fType.intValue();			i++;		}		/*		 * Make sure name and type given for each field.		 */				if (i != mFieldTypes.length || st.hasMoreTokens())		{			throw new MapyrusException("Different number of field " +				"names and field types in '" + filename + "'");		}		/*		 * Find indexes of fields caller says are the geometry for each row.		 */		v.clear();		for (i = 0; i < geometryFieldNames.length; i++)		{			foundGeometryField = false;			for (j = 0; j < mFieldNames.length; j++)			{				if (geometryFieldNames[i].equalsIgnoreCase(mFieldNames[j]))				{					if (mFieldTypes[j] == Argument.STRING)					{						throw new MapyrusException("Field '" + mFieldNames[j] +							"' is wrong type for geometry in file '" +							filename + "'");					}					v.add(new Integer(j));				}			}						if (foundGeometryField == false)			{				throw new MapyrusException("Geometry field '" +					mFieldNames[j] + "' not found in file '" + filename + "'");			}		}		/*		 * Save array of fields combined to make geometry for each row.		 */		mGeometryFieldIndexes = new int[v.size()];		for (i = 0; i < v.size(); i++)			mGeometryFieldIndexes[i] = ((Integer)(v.elementAt(i))).intValue();	}