org.geotools.data.mif
Class MIFStringTokenizer

java.lang.Object
  extended byorg.geotools.data.mif.MIFStringTokenizer
Direct Known Subclasses:
MIFFileTokenizer

public class MIFStringTokenizer
extends java.lang.Object

Simple tokenizer class

Version:
$Id: MIFStringTokenizer.java 17700 2006-01-22 23:30:39Z desruisseaux $
Author:
Luca S. Percich, AMA-MI

Constructor Summary
MIFStringTokenizer()
          Builds a tokenizer
 
Method Summary
 java.lang.String getLine()
          DOCUMENT ME!
protected  java.lang.String getToken()
          DOCUMENT ME!
protected  java.lang.String getToken(char separator)
          DOCUMENT ME!
protected  java.lang.String getToken(char separator, boolean nextLineIfEmpty)
          DOCUMENT ME!
 java.lang.String getToken(char separator, boolean nextLineIfEmpty, boolean quotedStrings)
          Cuts the first token from line buffer using the given separator, taking in to account string delimiters if needed
Strings might be delimited by double quotes.
 boolean isEmpty()
          Check for non-empty line buffer
static java.lang.String ltrim(java.lang.String untrimmed)
           
 void putToken(java.lang.String tok)
          Puts a token back to the input buffer so that the next call to getToken will return this token
 boolean readLine()
          Tries to read a line from the input buffer (if any) and store it in the line buffer
 boolean readLine(java.lang.String line)
          "Reads" a line from the given line, and initializes the token.
static java.lang.String strQuote(java.lang.String unquoted)
          DOCUMENT ME!
static java.lang.String strUnquote(java.lang.String quoted)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MIFStringTokenizer

public MIFStringTokenizer()
Builds a tokenizer

Method Detail

readLine

public boolean readLine(java.lang.String line)
"Reads" a line from the given line, and initializes the token.

Parameters:
line -
Returns:
true if could read a non empty line (i.e. line != "")

readLine

public boolean readLine()
Tries to read a line from the input buffer (if any) and store it in the line buffer

Returns:
True if a non-null string was read

getToken

public java.lang.String getToken(char separator,
                                 boolean nextLineIfEmpty,
                                 boolean quotedStrings)
                          throws com.vividsolutions.jts.io.ParseException
Cuts the first token from line buffer using the given separator, taking in to account string delimiters if needed
Strings might be delimited by double quotes. Escaping char is a double quote, i.e. "\"" becomes """".

Parameters:
separator - Character used as token separator.
nextLineIfEmpty - If the returned token is empty, try to read it from the next line.
quotedStrings - If true, expects a quoted string and read it, otherwise treats the double quotes as a normal char.
Returns:
The parsed token
Throws:
com.vividsolutions.jts.io.ParseException - DOCUMENT ME!

getToken

protected java.lang.String getToken(char separator,
                                    boolean nextLineIfEmpty)
                             throws com.vividsolutions.jts.io.ParseException
DOCUMENT ME!

Parameters:
separator - DOCUMENT ME!
nextLineIfEmpty - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
com.vividsolutions.jts.io.ParseException - DOCUMENT ME!

getToken

protected java.lang.String getToken(char separator)
                             throws com.vividsolutions.jts.io.ParseException
DOCUMENT ME!

Parameters:
separator - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
com.vividsolutions.jts.io.ParseException - DOCUMENT ME!

getToken

protected java.lang.String getToken()
                             throws com.vividsolutions.jts.io.ParseException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
com.vividsolutions.jts.io.ParseException - DOCUMENT ME!

putToken

public void putToken(java.lang.String tok)
Puts a token back to the input buffer so that the next call to getToken will return this token

Parameters:
tok - The token which has to be put back in the input buffer

strQuote

public static java.lang.String strQuote(java.lang.String unquoted)
DOCUMENT ME!

Parameters:
unquoted - DOCUMENT ME!
Returns:
DOCUMENT ME!

strUnquote

public static java.lang.String strUnquote(java.lang.String quoted)
DOCUMENT ME!

Parameters:
quoted - DOCUMENT ME!
Returns:
DOCUMENT ME!

ltrim

public static java.lang.String ltrim(java.lang.String untrimmed)

getLine

public java.lang.String getLine()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isEmpty

public boolean isEmpty()
Check for non-empty line buffer

Returns:
true if current line buffer is not empty


Copyright © GeoTools. All Rights Reserved.