bsh
public class PlexReader extends java.io.FilterReader
PlexReader
class is a wrapper for the input Reader for
interactive Interpreter instances. We intercept the read()
operations, and when input logging is enabled, we write (with conversion
if needed) the chars read()
into a log file. Such a file
can be read and executed later via the source()
command,
for instance.Constructor and Description |
---|
PlexReader(java.io.Reader in,
java.lang.String ws_name)
Constructor PlexReader, only called by PlexInterpreter().
|
Modifier and Type | Method and Description |
---|---|
void |
enable(java.lang.String log_name)
Enable logging, making sure that there is an underlying logstream.
|
java.lang.String |
log_status()
Return a String describing the logging status, including defaults.
|
int |
read(char[] buf,
int off,
int len)
Wrapper for normal read to buffer operation.
|
static void |
setDefaultDir(java.lang.String pathname)
Set the default logging directory.
|
static void |
setDefaultFlag(boolean flag)
Set the default logging flag.
|
void |
setLogfile(java.lang.String new_log_name)
Force logstream to go to specified filename.
|
public PlexReader(java.io.Reader in, java.lang.String ws_name)
in
- Input Reader for an interative interpreter instance.ws_name
- Workspace name, which we ignore.public void enable(java.lang.String log_name) throws java.io.IOException
log_name
- Name to use as logfile, or null, if the default is okay.java.io.IOException
public void setLogfile(java.lang.String new_log_name)
new_log_name
- Name to use as logfile -- must be the name of a
writable file.public int read(char[] buf, int off, int len) throws java.io.IOException
read
in class java.io.FilterReader
buf
- Where to write the characters read.off
- Offset at which to start writing the characters.len
- Max number of characters to read.java.io.IOException
public static void setDefaultFlag(boolean flag)
false
.
Invoked via the setLogging()
command.
flag
- If true, input logging is on by default, else off.public java.lang.String log_status()
public static void setDefaultDir(java.lang.String pathname)
~/plex
.
Invoked via the setLogging()
command.
pathname
- Set the default directory in which to store log files.