de.mud.jta.plugin
public class Script extends Plugin implements FilterPlugin
The script property Script.script should contain | separated strings where each two represent a match and answer pair. A newline will be appended to each answer!
If the first matching string is empty, the answer string will be sent upon connect. The script is very basic but is a very good example how to write a plugin for JTA - Telnet/SSH for the JAVA(tm) platform.
Maintainer: Matthias L. Jugel
Modifier and Type | Field and Description |
---|---|
protected FilterPlugin |
source
holds the data source for input and output
|
Constructor and Description |
---|
Script(PluginBus bus,
java.lang.String id)
Create a new scripting plugin.
|
Modifier and Type | Method and Description |
---|---|
FilterPlugin |
getFilterSource() |
int |
read(byte[] b)
Read an array of bytes from the back end and put it through the
script parser to see if it matches.
|
void |
setFilterSource(FilterPlugin plugin)
Set the filter source where we can read data from and where to
write the script answer to.
|
void |
write(byte[] b)
Write a block of data to the back end.
|
protected FilterPlugin source
public Script(PluginBus bus, java.lang.String id)
public void setFilterSource(FilterPlugin plugin)
setFilterSource
in interface FilterPlugin
plugin
- the filter plugin we use as sourcepublic FilterPlugin getFilterSource()
getFilterSource
in interface FilterPlugin
public int read(byte[] b) throws java.io.IOException
read
in interface FilterPlugin
b
- the array where to read the bytes injava.io.IOException
public void write(byte[] b) throws java.io.IOException
FilterPlugin
write
in interface FilterPlugin
b
- the buffer to be sentjava.io.IOException