|
|||||||||
| Home >> All >> javatools >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javatools.util
Class ScriptCatcher

java.lang.Objectjavatools.util.ScriptCatcher
- public class ScriptCatcher
- extends java.lang.Object
It's a class to catch text from a script file and to divide it into commands.
- Version:
- 0.1.10
| Field Summary | |
private java.util.ArrayList |
commandText
|
private java.lang.String |
commentDelimiter
|
private char |
divideCommandChar
|
private boolean |
removeFormat
|
private java.lang.Character |
stringDelimiterChar
|
| Constructor Summary | |
ScriptCatcher()
Creates new ScriptCatcher |
|
| Method Summary | |
void |
addCommand(java.lang.String value)
Adds a new command. |
void |
clear()
Removes all the commands. |
void |
constructCommands(java.lang.String textScript)
Construct commands fromf a given string (textScript) instead of a file. |
java.util.ArrayList |
getCommandList()
Returns the commands as a list. |
java.lang.String[] |
getCommands()
Returns the commands as an array. |
java.lang.String |
getCommandText(int numCommand)
Returns the command text of command numCommand. |
java.lang.String |
getCommentdelimiter()
Returns the string who represents the start of a comment. |
char |
getDivideCommandChar()
Returns the character who represents the end of a command. |
int |
getNumCommands()
Returns the number of commands. |
boolean |
getRemoveFormat()
Returns the property about removing formatting items (spaces and new-lines) |
java.lang.Character |
getStringDelimiterChar()
Returns the character who represents the start/end of a string in the script. |
static java.lang.String |
inputStream2String(java.io.InputStream is)
|
java.util.Iterator |
iterator()
Returns an iterator to iterate commands. |
void |
loadScript(java.io.InputStream is)
|
void |
loadScript(java.lang.String fileName)
Loads a script whose path is in "fileName" string, divides it into commands and make them available. |
java.lang.String |
removeComments(java.lang.String inStr)
Removes comments from a script (string inStr). |
private java.lang.String |
removeOneComment(java.lang.String tempString)
|
java.lang.String |
removeSpaces(java.lang.String cmdText)
Removes unuseful spaces, tabs and CRs from a command. |
void |
saveScript(java.lang.String fileName)
Saves a script using saved command texts into "fileName". |
void |
setCommandText(int numCommand,
java.lang.String value)
Sets the text for command numCommand with the string value. |
void |
setCommentDelimiter(java.lang.String inStr)
Sets the string who represents the start of a comment. |
void |
setDivideCommandChar(char inChar)
Sets the character who represents the end of a command. |
void |
setNumCommands(int numCommands)
Sets the number of commands. |
void |
setRemoveFormat(boolean value)
Controls whether formatting items (spaces and new-lines) are going to be removed. |
void |
setStringDelimiterChar(java.lang.Character inChar)
Sets the character who represents the start/end of a string in the script. |
static java.lang.String |
textFile2String(java.lang.String fileName)
Loads text file "fileName" and puts its content into a string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
commandText
private java.util.ArrayList commandText
divideCommandChar
private char divideCommandChar
stringDelimiterChar
private java.lang.Character stringDelimiterChar
commentDelimiter
private java.lang.String commentDelimiter
removeFormat
private boolean removeFormat
| Constructor Detail |
ScriptCatcher
public ScriptCatcher()
- Creates new ScriptCatcher
| Method Detail |
setRemoveFormat
public void setRemoveFormat(boolean value)
- Controls whether formatting items (spaces and new-lines) are going to be
removed.
getRemoveFormat
public boolean getRemoveFormat()
- Returns the property about removing formatting items (spaces and new-lines)
loadScript
public void loadScript(java.lang.String fileName) throws java.io.FileNotFoundException
- Loads a script whose path is in "fileName" string, divides it into commands and make them available.
loadScript
public void loadScript(java.io.InputStream is) throws java.io.IOException
saveScript
public void saveScript(java.lang.String fileName) throws java.io.IOException
- Saves a script using saved command texts into "fileName".
constructCommands
public void constructCommands(java.lang.String textScript)
- Construct commands fromf a given string (textScript) instead of a file.
removeSpaces
public java.lang.String removeSpaces(java.lang.String cmdText)
- Removes unuseful spaces, tabs and CRs from a command.
WARNING! The text has to be a command WITHOUT command delimiter (default ;)!
removeComments
public java.lang.String removeComments(java.lang.String inStr)
- Removes comments from a script (string inStr).
clear
public void clear()
- Removes all the commands.
getNumCommands
public int getNumCommands()
- Returns the number of commands.
setNumCommands
public void setNumCommands(int numCommands)
throws java.lang.IndexOutOfBoundsException
- Sets the number of commands. There's no need to use it if you are
loading a script file or using a script string.
You need it ONLY if you are going to give commands one by one.
All previous saved commands will be erased.
getCommandText
public java.lang.String getCommandText(int numCommand) throws java.lang.IndexOutOfBoundsException
- Returns the command text of command
numCommand.
getCommands
public java.lang.String[] getCommands()
- Returns the commands as an array.
getCommandList
public java.util.ArrayList getCommandList()
- Returns the commands as a list.
iterator
public java.util.Iterator iterator()
- Returns an iterator to iterate commands.
addCommand
public void addCommand(java.lang.String value)
- Adds a new command.
setCommandText
public void setCommandText(int numCommand,
java.lang.String value)
throws java.lang.IndexOutOfBoundsException
- Sets the text for command
numCommandwith the stringvalue.
setDivideCommandChar
public void setDivideCommandChar(char inChar)
- Sets the character who represents the end of a command.
getDivideCommandChar
public char getDivideCommandChar()
- Returns the character who represents the end of a command.
setStringDelimiterChar
public void setStringDelimiterChar(java.lang.Character inChar)
- Sets the character who represents the start/end of a string in the script.
getStringDelimiterChar
public java.lang.Character getStringDelimiterChar()
- Returns the character who represents the start/end of a string in the script.
setCommentDelimiter
public void setCommentDelimiter(java.lang.String inStr)
- Sets the string who represents the start of a comment.
getCommentdelimiter
public java.lang.String getCommentdelimiter()
- Returns the string who represents the start of a comment.
textFile2String
public static java.lang.String textFile2String(java.lang.String fileName) throws java.io.FileNotFoundException
- Loads text file "fileName" and puts its content into a string.
inputStream2String
public static java.lang.String inputStream2String(java.io.InputStream is) throws java.io.IOException
removeOneComment
private java.lang.String removeOneComment(java.lang.String tempString)
|
|||||||||
| Home >> All >> javatools >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
javatools.util.ScriptCatcher