org.adougou.cline
Class URLCommand
java.lang.Object
|
+--org.adougou.cline.BaseCommand
|
+--org.adougou.cline.URLCommand
- All Implemented Interfaces:
- Command
- Direct Known Subclasses:
- RunScriptCommand
- public abstract class URLCommand
- extends BaseCommand
Any command that loads a URL (eg. file) for input should extend this
command. It basically checks that the Strings representing the URLs
are valid and returns URL instances as an enumeration (takes some of
the pain out of creating URLs). It is used by the RunScriptCommand.
- See Also:
RunScriptCommand
|
Constructor Summary |
protected |
URLCommand(java.lang.String name,
int numArgs,
java.lang.String help)
|
|
Method Summary |
java.io.BufferedReader |
getBufferedReader(java.net.URL url)
Utility method that given a URL, allocates a BufferedReader and
opens the URL for reading data. |
java.util.Iterator |
getURLs(java.lang.String[] args)
Given an array of Strings, try and create a URL from each String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
URLCommand
protected URLCommand(java.lang.String name,
int numArgs,
java.lang.String help)
getURLs
public java.util.Iterator getURLs(java.lang.String[] args)
- Given an array of Strings, try and create a URL from each String.
If a valid URL can be created from the string, it will be added to
a list, and the iterator for this list is returned.
getBufferedReader
public java.io.BufferedReader getBufferedReader(java.net.URL url)
- Utility method that given a URL, allocates a BufferedReader and
opens the URL for reading data.