Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gnu.readline
Class ReadlineReader  view ReadlineReader download ReadlineReader.java

java.lang.Object
  extended byjava.io.Reader
      extended byorg.gnu.readline.ReadlineReader

public class ReadlineReader
extends java.io.Reader

A Reader wrapper for the Readline classes. This seems to work fine in conjunction with such classes as BufferedReader, but it hasn't been tested well enough to see if this will work well in all cases. This was implemented to make it easier to supplant Readline's functionality [shrug] anywhere and everywhere, but specifically in BeanShell.

Version:
$Revision: 1.2 $

Field Summary
static java.lang.String DEFAULT_PROMPT
           
private  java.lang.StringBuffer iBuff
           
private  java.io.File iHistoryFile
           
private  java.lang.String iLineSeparator
           
private  java.lang.String iPrompt
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
ReadlineReader(java.io.File history, ReadlineLibrary lib)
          Constructs a ReadlineReader object with an associated history file.
ReadlineReader(ReadlineLibrary lib)
          Constructs a ReadlineReader object with the default prompt.
ReadlineReader(java.lang.String prompt, java.io.File history, ReadlineLibrary lib)
          Constructs a ReadlineReader object with an associated history file and prompt.
ReadlineReader(java.lang.String prompt, ReadlineLibrary lib)
          Constructs a ReadlineReader object with the given prompt.
 
Method Summary
 void close()
          Nullifies all buffers and writes history file if one was given at construction time.
 java.lang.String getPrompt()
          Returns the current prompt.
static void main(java.lang.String[] args)
           
 int read(char[] cbuf, int off, int len)
          Reads what's given from readline() into a buffer.
 void setPrompt(java.lang.String prompt)
          Sets the prompt to the given value.
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROMPT

public static final java.lang.String DEFAULT_PROMPT
See Also:
Constant Field Values

iBuff

private java.lang.StringBuffer iBuff

iLineSeparator

private java.lang.String iLineSeparator

iPrompt

private java.lang.String iPrompt

iHistoryFile

private java.io.File iHistoryFile
Constructor Detail

ReadlineReader

public ReadlineReader(java.lang.String prompt,
                      ReadlineLibrary lib)
Constructs a ReadlineReader object with the given prompt.


ReadlineReader

public ReadlineReader(ReadlineLibrary lib)
Constructs a ReadlineReader object with the default prompt.


ReadlineReader

public ReadlineReader(java.io.File history,
                      ReadlineLibrary lib)
               throws java.io.IOException
Constructs a ReadlineReader object with an associated history file.


ReadlineReader

public ReadlineReader(java.lang.String prompt,
                      java.io.File history,
                      ReadlineLibrary lib)
               throws java.io.IOException
Constructs a ReadlineReader object with an associated history file and prompt.

Method Detail

getPrompt

public java.lang.String getPrompt()
Returns the current prompt.


setPrompt

public void setPrompt(java.lang.String prompt)
Sets the prompt to the given value.


read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Reads what's given from readline() into a buffer. When that buffer is emptied, readline() is called again to replenish that buffer. This seems to work fine in conjunction with such classes as BufferedReader, but it hasn't been tested well enough to see if this will work well in all cases.


close

public void close()
           throws java.io.IOException
Nullifies all buffers and writes history file if one was given at construction time.


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception