Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

postgresql.util
Class PGtokenizer  view PGtokenizer download PGtokenizer.java

java.lang.Object
  extended bypostgresql.util.PGtokenizer

public class PGtokenizer
extends java.lang.Object

This class is used to tokenize the text output of postgres.

It's mainly used by the geometric classes, but is useful in parsing any output from custom data types output from postgresql.


Field Summary
protected  java.util.Vector tokens
           
 
Constructor Summary
PGtokenizer(java.lang.String string, char delim)
          Create a tokeniser.
 
Method Summary
 int getSize()
           
 java.lang.String getToken(int n)
           
 void remove(java.lang.String l, java.lang.String t)
          This removes the lead/trailing strings from all tokens
static java.lang.String remove(java.lang.String s, java.lang.String l, java.lang.String t)
          This removes the lead/trailing strings from a string
 void removeAngle()
          Removes < and > from the beginning and end of all tokens
static java.lang.String removeAngle(java.lang.String s)
          Removes < and > from the beginning and end of a string
 void removeBox()
          Removes [ and ] from the beginning and end of all tokens
static java.lang.String removeBox(java.lang.String s)
          Removes [ and ] from the beginning and end of a string
 void removePara()
          Removes ( and ) from the beginning and end of all tokens
static java.lang.String removePara(java.lang.String s)
          Removes ( and ) from the beginning and end of a string
 int tokenize(java.lang.String string, char delim)
          This resets this tokenizer with a new string and/or delimiter.
 PGtokenizer tokenizeToken(int n, char delim)
          This returns a new tokenizer based on one of our tokens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokens

protected java.util.Vector tokens
Constructor Detail

PGtokenizer

public PGtokenizer(java.lang.String string,
                   char delim)
Create a tokeniser.

We could have used StringTokenizer to do this, however, we needed to handle nesting of '(' ')' '[' ']' '<' and '>' as these are used by the geometric data types.

Method Detail

tokenize

public int tokenize(java.lang.String string,
                    char delim)
This resets this tokenizer with a new string and/or delimiter.


getSize

public int getSize()

getToken

public java.lang.String getToken(int n)

tokenizeToken

public PGtokenizer tokenizeToken(int n,
                                 char delim)
This returns a new tokenizer based on one of our tokens. The geometric datatypes use this to process nested tokens (usually PGpoint).


remove

public static java.lang.String remove(java.lang.String s,
                                      java.lang.String l,
                                      java.lang.String t)
This removes the lead/trailing strings from a string


remove

public void remove(java.lang.String l,
                   java.lang.String t)
This removes the lead/trailing strings from all tokens


removePara

public static java.lang.String removePara(java.lang.String s)
Removes ( and ) from the beginning and end of a string


removePara

public void removePara()
Removes ( and ) from the beginning and end of all tokens


removeBox

public static java.lang.String removeBox(java.lang.String s)
Removes [ and ] from the beginning and end of a string


removeBox

public void removeBox()
Removes [ and ] from the beginning and end of all tokens


removeAngle

public static java.lang.String removeAngle(java.lang.String s)
Removes < and > from the beginning and end of a string


removeAngle

public void removeAngle()
Removes < and > from the beginning and end of all tokens