edu.vt.marian.uip
Class StringPool

java.lang.Object
  |
  +--edu.vt.marian.uip.StringPool

public class StringPool
extends java.lang.Object

Class name: StringPool Class description: This class is only for the easy operation of formit and webgate, since it's heavily used in the original system, we'd better keep it here otherwise significant modification will be needed to handle html format. But some function/methods are added to reduce coupling between different classes Author: Jianxin Zhao Finished time: June 4, 1998 Known bugs: none Platform: jdk1.1.5 under UNIX


Constructor Summary
StringPool(edu.vt.marian.common.Debug debug)
          This constructor just create an empty string pool
StringPool(java.io.InputStream is, edu.vt.marian.common.Debug debug)
          This constructor will create a string pool object from a stream, this is a new method added to this class
StringPool(packet_input_stream pis, edu.vt.marian.common.Debug debug)
          This constructor will create a string pool object from a stream, this is a new method added to this class
 
Method Summary
 void AddCGIData(java.lang.String data)
          This method will add the cgi data to the string pool, it will first decode special chars like '+', '%', '&' then add the strings seperated by them to the string pool I believe this method reduced the coupling between different classes
 void AddString(java.lang.String s)
          This method will add the string to the string pool
 void AddSubString(java.lang.String s)
          This method will add part of the string (strings between data seperaters) into the string pool
 void AddValue(java.lang.String name, java.lang.String value)
          This method will add the name value pair to the string pool, this method and the method GetValue will make handling cgi data easy
 void DeleteString(int num)
          This method will delete the numth string from the string pool.
 java.util.Vector get_names()
          this method will return the name list in this object
 java.util.Vector get_names(java.lang.String value)
          this method will return the name list in this object which have the specified value
 int GetHexValue(java.lang.String digits)
          This method will return the hex value of the parameter digits, -1 will be returned if digits is not a valid hex digit string, by using ...length() insteadof 16 we improve the function's flexibility.
 int GetNumLines(int num)
          This method will return the number of lines in the numth string of the string pool
 int GetNumStrings()
          This method will return the number of strings currently exist in the string pool
 java.lang.String GetString(int num)
          This method will return the numth string currently in the string pool, null will be returned if the num is out of bound
 java.lang.String GetValue(java.lang.String name)
          This method will return the value of the name in the string pool, null will be returned if no such value exist in the string pool
 void to_stream(packet_output_stream pos)
          This method will print the content of this string pool object to a stream this method can be used with the above constructor in network environment
 void to_stream(java.io.PrintWriter pw)
          This method will print the content of this string pool object to a stream this method can be used with the above constructor in network environment
 void toStream(java.io.OutputStream os)
          This method will print the content of this string pool object to a stream this method can be used with the above constructor in network environment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringPool

public StringPool(edu.vt.marian.common.Debug debug)
This constructor just create an empty string pool

StringPool

public StringPool(java.io.InputStream is,
                  edu.vt.marian.common.Debug debug)
This constructor will create a string pool object from a stream, this is a new method added to this class

StringPool

public StringPool(packet_input_stream pis,
                  edu.vt.marian.common.Debug debug)
This constructor will create a string pool object from a stream, this is a new method added to this class
Method Detail

toStream

public void toStream(java.io.OutputStream os)
This method will print the content of this string pool object to a stream this method can be used with the above constructor in network environment

to_stream

public void to_stream(java.io.PrintWriter pw)
This method will print the content of this string pool object to a stream this method can be used with the above constructor in network environment

to_stream

public void to_stream(packet_output_stream pos)
This method will print the content of this string pool object to a stream this method can be used with the above constructor in network environment

AddString

public void AddString(java.lang.String s)
This method will add the string to the string pool

AddSubString

public void AddSubString(java.lang.String s)
This method will add part of the string (strings between data seperaters) into the string pool

AddValue

public void AddValue(java.lang.String name,
                     java.lang.String value)
This method will add the name value pair to the string pool, this method and the method GetValue will make handling cgi data easy

GetValue

public java.lang.String GetValue(java.lang.String name)
This method will return the value of the name in the string pool, null will be returned if no such value exist in the string pool

get_names

public java.util.Vector get_names(java.lang.String value)
this method will return the name list in this object which have the specified value

get_names

public java.util.Vector get_names()
this method will return the name list in this object

GetNumStrings

public int GetNumStrings()
This method will return the number of strings currently exist in the string pool

GetString

public java.lang.String GetString(int num)
This method will return the numth string currently in the string pool, null will be returned if the num is out of bound

DeleteString

public void DeleteString(int num)
This method will delete the numth string from the string pool. This method is for the completeness of this class though it's not used in the current system.

GetNumLines

public int GetNumLines(int num)
This method will return the number of lines in the numth string of the string pool

AddCGIData

public void AddCGIData(java.lang.String data)
This method will add the cgi data to the string pool, it will first decode special chars like '+', '%', '&' then add the strings seperated by them to the string pool I believe this method reduced the coupling between different classes

GetHexValue

public int GetHexValue(java.lang.String digits)
This method will return the hex value of the parameter digits, -1 will be returned if digits is not a valid hex digit string, by using ...length() insteadof 16 we improve the function's flexibility.