Class pmr.util.StringList
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.util.StringList
java.lang.Object
|
+----pmr.util.StringList
- public class StringList
- extends Object
a simple storage for Strings (e.g. from input file); There are an
arbitrary number of elements, each a String. A file can be read into a
StringList and then successive lines can be extracted. There is doubtless
a better way using Java :-(
probably will become obsolete ...
- Author:
- (C) P. Murray-Rust, 1996
-
StringList()
-
-
StringList(int)
-
-
StringList(String)
- from whitespace-separated strings (" ", "\n", "\t")
-
StringList(String, String)
- from delimiter-separated strings (delimiter(s) are lost)
-
StringList(String[])
- from an array of Strings; *COPIED*
-
add(String)
-
-
addElement(String)
- synonymous with above
-
append(String[])
- append an array of Strings
-
append(StringList)
- add another StringList; by REFERENCE
-
contract()
- return unused buffer space
-
debug()
-
-
elementAt(int)
- synonymous with above
-
getCurrentLine()
- read the current line and advance pointer by one line
-
getItem(int)
-
-
getLineNumber()
- return the line pointer
-
getStrings()
- return the list as an array of Strings
-
getStrings(String)
- make an array of Strings out of space-separated tokens in 's'
-
outputToFile(File)
- output to a file (lines are separated by \n)
-
outputToFile(String)
- output to a file (lines are separated by \n)
-
peekLine()
- read the current line but do not advance pointer
-
prepend(String[])
- prepend an array of Strings
-
print()
-
-
readFile(String)
- from a filename (local)
-
readURL(String)
- from a URL (e.g.
-
readURL(URL)
- alternative to the above
-
resetGet()
- reset to start of file
-
setLastLineToNull()
- set the last line to null (useful when memory is short).
-
setLineNumber(int)
- sets the pointer to a given line number (no action if outside range)
-
size()
-
-
toString()
- output as list of Strings, separated by \n (best we can do fo a simple
application
StringList
public StringList()
StringList
public StringList(String s[])
- from an array of Strings; *COPIED*
StringList
public StringList(int nbuff)
StringList
public StringList(String s,
String delim)
- from delimiter-separated strings (delimiter(s) are lost)
- Parameters:
- delim - has the same form as StringTokenizer
StringList
public StringList(String s)
- from whitespace-separated strings (" ", "\n", "\t")
readFile
public static StringList readFile(String filename) throws FileNotFoundException, IOException
- from a filename (local)
readURL
public static StringList readURL(String urlname) throws MalformedURLException, IOException
- from a URL (e.g. in an applet)
readURL
public static StringList readURL(URL url) throws IOException
- alternative to the above
contract
public void contract()
- return unused buffer space
size
public int size()
getStrings
public String[] getStrings()
- return the list as an array of Strings
getStrings
public static String[] getStrings(String s)
- make an array of Strings out of space-separated tokens in 's'
getItem
public String getItem(int i)
elementAt
public String elementAt(int i)
- synonymous with above
add
public void add(String a)
addElement
public void addElement(String s)
- synonymous with above
append
public void append(StringList s)
- add another StringList; by REFERENCE
prepend
public void prepend(String s[])
- prepend an array of Strings
append
public void append(String strings[])
- append an array of Strings
getLineNumber
public int getLineNumber()
- return the line pointer
setLineNumber
public void setLineNumber(int i)
- sets the pointer to a given line number (no action if outside range)
setLastLineToNull
public void setLastLineToNull()
- set the last line to null (useful when memory is short). Does not
delete the line pointer or alter line numbers; of course the StringList
cannot then be rewound and re-read
resetGet
public void resetGet()
- reset to start of file
getCurrentLine
public String getCurrentLine()
- read the current line and advance pointer by one line
peekLine
public String peekLine()
- read the current line but do not advance pointer
print
public void print()
outputToFile
public void outputToFile(File f) throws IOException
- output to a file (lines are separated by \n)
- Throws: IOException
- an output error occured
outputToFile
public void outputToFile(String s) throws IOException
- output to a file (lines are separated by \n)
- Throws: IOException
- an output error occured
toString
public String toString()
- output as list of Strings, separated by \n (best we can do fo a simple
application
- Overrides:
- toString in class Object
debug
public void debug()
All Packages Class Hierarchy This Package Previous Next Index