jline-1.0

16:37:55.424 INFO  jd.cli.Main - Decompiling jline-1.0.jar
package jline;

public class ANSIBuffer$ANSICodes
{
  static final int OFF = 0;
  static final int BOLD = 1;
  static final int UNDERSCORE = 4;
  static final int BLINK = 5;
  static final int REVERSE = 7;
  static final int CONCEALED = 8;
  static final int FG_BLACK = 30;
  static final int FG_RED = 31;
  static final int FG_GREEN = 32;
  static final int FG_YELLOW = 33;
  static final int FG_BLUE = 34;
  static final int FG_MAGENTA = 35;
  static final int FG_CYAN = 36;
  static final int FG_WHITE = 37;
  static final char ESC = '\033';
  
  public static String setmode(int mode)
  {
    return "\033[=" + mode + "h";
  }
  
  public static String resetmode(int mode)
  {
    return "\033[=" + mode + "l";
  }
  
  public static String clrscr()
  {
    return "\033[2J";
  }
  
  public static String clreol()
  {
    return "\033[K";
  }
  
  public static String left(int n)
  {
    return "\033[" + n + "D";
  }
  
  public static String right(int n)
  {
    return "\033[" + n + "C";
  }
  
  public static String up(int n)
  {
    return "\033[" + n + "A";
  }
  
  public static String down(int n)
  {
    return "\033[" + n + "B";
  }
  
  public static String gotoxy(int row, int column)
  {
    return "\033[" + row + ";" + column + "H";
  }
  
  public static String save()
  {
    return "\033[s";
  }
  
  public static String restore()
  {
    return "\033[u";
  }
  
  public static String attrib(int attr)
  {
    return "\033[" + attr + "m";
  }
  
  public static String setkey(String code, String value)
  {
    return "\033[" + code + ";" + value + "p";
  }
}

/* Location:
 * Qualified Name:     jline.ANSIBuffer.ANSICodes
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;

public class ANSIBuffer
{
  private boolean ansiEnabled = true;
  private final StringBuffer ansiBuffer = new StringBuffer();
  private final StringBuffer plainBuffer = new StringBuffer();
  
  public ANSIBuffer() {}
  
  public ANSIBuffer(String str)
  {
    append(str);
  }
  
  public void setAnsiEnabled(boolean ansi)
  {
    ansiEnabled = ansi;
  }
  
  public boolean getAnsiEnabled()
  {
    return ansiEnabled;
  }
  
  public String getAnsiBuffer()
  {
    return ansiBuffer.toString();
  }
  
  public String getPlainBuffer()
  {
    return plainBuffer.toString();
  }
  
  public String toString(boolean ansi)
  {
    return ansi ? getAnsiBuffer() : getPlainBuffer();
  }
  
  public String toString()
  {
    return toString(ansiEnabled);
  }
  
  public ANSIBuffer append(String str)
  {
    ansiBuffer.append(str);
    plainBuffer.append(str);
    
    return this;
  }
  
  public ANSIBuffer attrib(String str, int code)
  {
    ansiBuffer.append(ANSICodes.attrib(code)).append(str).append(ANSICodes.attrib(0));
    
    plainBuffer.append(str);
    
    return this;
  }
  
  public ANSIBuffer red(String str)
  {
    return attrib(str, 31);
  }
  
  public ANSIBuffer blue(String str)
  {
    return attrib(str, 34);
  }
  
  public ANSIBuffer green(String str)
  {
    return attrib(str, 32);
  }
  
  public ANSIBuffer black(String str)
  {
    return attrib(str, 30);
  }
  
  public ANSIBuffer yellow(String str)
  {
    return attrib(str, 33);
  }
  
  public ANSIBuffer magenta(String str)
  {
    return attrib(str, 35);
  }
  
  public ANSIBuffer cyan(String str)
  {
    return attrib(str, 36);
  }
  
  public ANSIBuffer bold(String str)
  {
    return attrib(str, 1);
  }
  
  public ANSIBuffer underscore(String str)
  {
    return attrib(str, 4);
  }
  
  public ANSIBuffer blink(String str)
  {
    return attrib(str, 5);
  }
  
  public ANSIBuffer reverse(String str)
  {
    return attrib(str, 7);
  }
  
  public static class ANSICodes
  {
    static final int OFF = 0;
    static final int BOLD = 1;
    static final int UNDERSCORE = 4;
    static final int BLINK = 5;
    static final int REVERSE = 7;
    static final int CONCEALED = 8;
    static final int FG_BLACK = 30;
    static final int FG_RED = 31;
    static final int FG_GREEN = 32;
    static final int FG_YELLOW = 33;
    static final int FG_BLUE = 34;
    static final int FG_MAGENTA = 35;
    static final int FG_CYAN = 36;
    static final int FG_WHITE = 37;
    static final char ESC = '\033';
    
    public static String setmode(int mode)
    {
      return "\033[=" + mode + "h";
    }
    
    public static String resetmode(int mode)
    {
      return "\033[=" + mode + "l";
    }
    
    public static String clrscr()
    {
      return "\033[2J";
    }
    
    public static String clreol()
    {
      return "\033[K";
    }
    
    public static String left(int n)
    {
      return "\033[" + n + "D";
    }
    
    public static String right(int n)
    {
      return "\033[" + n + "C";
    }
    
    public static String up(int n)
    {
      return "\033[" + n + "A";
    }
    
    public static String down(int n)
    {
      return "\033[" + n + "B";
    }
    
    public static String gotoxy(int row, int column)
    {
      return "\033[" + row + ";" + column + "H";
    }
    
    public static String save()
    {
      return "\033[s";
    }
    
    public static String restore()
    {
      return "\033[u";
    }
    
    public static String attrib(int attr)
    {
      return "\033[" + attr + "m";
    }
    
    public static String setkey(String code, String value)
    {
      return "\033[" + code + ";" + value + "p";
    }
  }
  
  public static void main(String[] args)
    throws Exception
  {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    
    System.out.print(ANSICodes.setkey("97", "97;98;99;13") + ANSICodes.attrib(0));
    
    System.out.flush();
    String line;
    while ((line = reader.readLine()) != null) {
      System.out.println("GOT: " + line);
    }
  }
}

/* Location:
 * Qualified Name:     jline.ANSIBuffer
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.util.LinkedList;
import java.util.List;

public abstract class ArgumentCompletor$AbstractArgumentDelimiter
  implements ArgumentCompletor.ArgumentDelimiter
{
  private char[] quoteChars = { '\'', '"' };
  private char[] escapeChars = { '\\' };
  
  public void setQuoteChars(char[] quoteChars)
  {
    this.quoteChars = quoteChars;
  }
  
  public char[] getQuoteChars()
  {
    return quoteChars;
  }
  
  public void setEscapeChars(char[] escapeChars)
  {
    this.escapeChars = escapeChars;
  }
  
  public char[] getEscapeChars()
  {
    return escapeChars;
  }
  
  public ArgumentCompletor.ArgumentList delimit(String buffer, int cursor)
  {
    List args = new LinkedList();
    StringBuffer arg = new StringBuffer();
    int argpos = -1;
    int bindex = -1;
    for (int i = 0; (buffer != null) && (i <= buffer.length()); i++)
    {
      if (i == cursor)
      {
        bindex = args.size();
        
        argpos = arg.length();
      }
      if ((i == buffer.length()) || (isDelimiter(buffer, i)))
      {
        if (arg.length() > 0)
        {
          args.add(arg.toString());
          arg.setLength(0);
        }
      }
      else {
        arg.append(buffer.charAt(i));
      }
    }
    return new ArgumentCompletor.ArgumentList((String[])args.toArray(new String[args.size()]), bindex, argpos, cursor);
  }
  
  public boolean isDelimiter(String buffer, int pos)
  {
    if (isQuoted(buffer, pos)) {
      return false;
    }
    if (isEscaped(buffer, pos)) {
      return false;
    }
    return isDelimiterChar(buffer, pos);
  }
  
  public boolean isQuoted(String buffer, int pos)
  {
    return false;
  }
  
  public boolean isEscaped(String buffer, int pos)
  {
    if (pos <= 0) {
      return false;
    }
    for (int i = 0; (escapeChars != null) && (i < escapeChars.length); i++) {
      if (buffer.charAt(pos) == escapeChars[i]) {
        return !isEscaped(buffer, pos - 1);
      }
    }
    return false;
  }
  
  public abstract boolean isDelimiterChar(String paramString, int paramInt);
}

/* Location:
 * Qualified Name:     jline.ArgumentCompletor.AbstractArgumentDelimiter
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

public abstract interface ArgumentCompletor$ArgumentDelimiter
{
  public abstract ArgumentCompletor.ArgumentList delimit(String paramString, int paramInt);
  
  public abstract boolean isDelimiter(String paramString, int paramInt);
}

/* Location:
 * Qualified Name:     jline.ArgumentCompletor.ArgumentDelimiter
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

public class ArgumentCompletor$ArgumentList
{
  private String[] arguments;
  private int cursorArgumentIndex;
  private int argumentPosition;
  private int bufferPosition;
  
  public ArgumentCompletor$ArgumentList(String[] arguments, int cursorArgumentIndex, int argumentPosition, int bufferPosition)
  {
    this.arguments = arguments;
    this.cursorArgumentIndex = cursorArgumentIndex;
    this.argumentPosition = argumentPosition;
    this.bufferPosition = bufferPosition;
  }
  
  public void setCursorArgumentIndex(int cursorArgumentIndex)
  {
    this.cursorArgumentIndex = cursorArgumentIndex;
  }
  
  public int getCursorArgumentIndex()
  {
    return cursorArgumentIndex;
  }
  
  public String getCursorArgument()
  {
    if ((cursorArgumentIndex < 0) || (cursorArgumentIndex >= arguments.length)) {
      return null;
    }
    return arguments[cursorArgumentIndex];
  }
  
  public void setArgumentPosition(int argumentPosition)
  {
    this.argumentPosition = argumentPosition;
  }
  
  public int getArgumentPosition()
  {
    return argumentPosition;
  }
  
  public void setArguments(String[] arguments)
  {
    this.arguments = arguments;
  }
  
  public String[] getArguments()
  {
    return arguments;
  }
  
  public void setBufferPosition(int bufferPosition)
  {
    this.bufferPosition = bufferPosition;
  }
  
  public int getBufferPosition()
  {
    return bufferPosition;
  }
}

/* Location:
 * Qualified Name:     jline.ArgumentCompletor.ArgumentList
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

public class ArgumentCompletor$WhitespaceArgumentDelimiter
  extends ArgumentCompletor.AbstractArgumentDelimiter
{
  public boolean isDelimiterChar(String buffer, int pos)
  {
    return Character.isWhitespace(buffer.charAt(pos));
  }
}

/* Location:
 * Qualified Name:     jline.ArgumentCompletor.WhitespaceArgumentDelimiter
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.util.LinkedList;
import java.util.List;

public class ArgumentCompletor
  implements Completor
{
  final Completor[] completors;
  final ArgumentDelimiter delim;
  boolean strict = true;
  
  public ArgumentCompletor(Completor completor)
  {
    this(new Completor[] { completor });
  }
  
  public ArgumentCompletor(List completors)
  {
    this((Completor[])completors.toArray(new Completor[completors.size()]));
  }
  
  public ArgumentCompletor(Completor[] completors)
  {
    this(completors, new WhitespaceArgumentDelimiter());
  }
  
  public ArgumentCompletor(Completor completor, ArgumentDelimiter delim)
  {
    this(new Completor[] { completor }, delim);
  }
  
  public ArgumentCompletor(Completor[] completors, ArgumentDelimiter delim)
  {
    this.completors = completors;
    this.delim = delim;
  }
  
  public void setStrict(boolean strict)
  {
    this.strict = strict;
  }
  
  public boolean getStrict()
  {
    return strict;
  }
  
  public int complete(String buffer, int cursor, List candidates)
  {
    ArgumentList list = delim.delimit(buffer, cursor);
    int argpos = list.getArgumentPosition();
    int argIndex = list.getCursorArgumentIndex();
    if (argIndex < 0) {
      return -1;
    }
    Completor comp;
    Completor comp;
    if (argIndex >= completors.length) {
      comp = completors[(completors.length - 1)];
    } else {
      comp = completors[argIndex];
    }
    for (int i = 0; (getStrict()) && (i < argIndex); i++)
    {
      Completor sub = completors[i];
      
      String[] args = list.getArguments();
      String arg = (args == null) || (i >= args.length) ? "" : args[i];
      
      List subCandidates = new LinkedList();
      if (sub.complete(arg, arg.length(), subCandidates) == -1) {
        return -1;
      }
      if (subCandidates.size() == 0) {
        return -1;
      }
    }
    int ret = comp.complete(list.getCursorArgument(), argpos, candidates);
    if (ret == -1) {
      return -1;
    }
    int pos = ret + (list.getBufferPosition() - argpos);
    if ((cursor != buffer.length()) && (delim.isDelimiter(buffer, cursor))) {
      for (int i = 0; i < candidates.size(); i++)
      {
        String val = candidates.get(i).toString();
        while ((val.length() > 0) && (delim.isDelimiter(val, val.length() - 1))) {
          val = val.substring(0, val.length() - 1);
        }
        candidates.set(i, val);
      }
    }
    ConsoleReader.debug("Completing " + buffer + "(pos=" + cursor + ") " + "with: " + candidates + ": offset=" + pos);
    
    return pos;
  }
  
  public static abstract interface ArgumentDelimiter
  {
    public abstract ArgumentCompletor.ArgumentList delimit(String paramString, int paramInt);
    
    public abstract boolean isDelimiter(String paramString, int paramInt);
  }
  
  public static abstract class AbstractArgumentDelimiter
    implements ArgumentCompletor.ArgumentDelimiter
  {
    private char[] quoteChars = { '\'', '"' };
    private char[] escapeChars = { '\\' };
    
    public void setQuoteChars(char[] quoteChars)
    {
      this.quoteChars = quoteChars;
    }
    
    public char[] getQuoteChars()
    {
      return quoteChars;
    }
    
    public void setEscapeChars(char[] escapeChars)
    {
      this.escapeChars = escapeChars;
    }
    
    public char[] getEscapeChars()
    {
      return escapeChars;
    }
    
    public ArgumentCompletor.ArgumentList delimit(String buffer, int cursor)
    {
      List args = new LinkedList();
      StringBuffer arg = new StringBuffer();
      int argpos = -1;
      int bindex = -1;
      for (int i = 0; (buffer != null) && (i <= buffer.length()); i++)
      {
        if (i == cursor)
        {
          bindex = args.size();
          
          argpos = arg.length();
        }
        if ((i == buffer.length()) || (isDelimiter(buffer, i)))
        {
          if (arg.length() > 0)
          {
            args.add(arg.toString());
            arg.setLength(0);
          }
        }
        else {
          arg.append(buffer.charAt(i));
        }
      }
      return new ArgumentCompletor.ArgumentList((String[])args.toArray(new String[args.size()]), bindex, argpos, cursor);
    }
    
    public boolean isDelimiter(String buffer, int pos)
    {
      if (isQuoted(buffer, pos)) {
        return false;
      }
      if (isEscaped(buffer, pos)) {
        return false;
      }
      return isDelimiterChar(buffer, pos);
    }
    
    public boolean isQuoted(String buffer, int pos)
    {
      return false;
    }
    
    public boolean isEscaped(String buffer, int pos)
    {
      if (pos <= 0) {
        return false;
      }
      for (int i = 0; (escapeChars != null) && (i < escapeChars.length); i++) {
        if (buffer.charAt(pos) == escapeChars[i]) {
          return !isEscaped(buffer, pos - 1);
        }
      }
      return false;
    }
    
    public abstract boolean isDelimiterChar(String paramString, int paramInt);
  }
  
  public static class WhitespaceArgumentDelimiter
    extends ArgumentCompletor.AbstractArgumentDelimiter
  {
    public boolean isDelimiterChar(String buffer, int pos)
    {
      return Character.isWhitespace(buffer.charAt(pos));
    }
  }
  
  public static class ArgumentList
  {
    private String[] arguments;
    private int cursorArgumentIndex;
    private int argumentPosition;
    private int bufferPosition;
    
    public ArgumentList(String[] arguments, int cursorArgumentIndex, int argumentPosition, int bufferPosition)
    {
      this.arguments = arguments;
      this.cursorArgumentIndex = cursorArgumentIndex;
      this.argumentPosition = argumentPosition;
      this.bufferPosition = bufferPosition;
    }
    
    public void setCursorArgumentIndex(int cursorArgumentIndex)
    {
      this.cursorArgumentIndex = cursorArgumentIndex;
    }
    
    public int getCursorArgumentIndex()
    {
      return cursorArgumentIndex;
    }
    
    public String getCursorArgument()
    {
      if ((cursorArgumentIndex < 0) || (cursorArgumentIndex >= arguments.length)) {
        return null;
      }
      return arguments[cursorArgumentIndex];
    }
    
    public void setArgumentPosition(int argumentPosition)
    {
      this.argumentPosition = argumentPosition;
    }
    
    public int getArgumentPosition()
    {
      return argumentPosition;
    }
    
    public void setArguments(String[] arguments)
    {
      this.arguments = arguments;
    }
    
    public String[] getArguments()
    {
      return arguments;
    }
    
    public void setBufferPosition(int bufferPosition)
    {
      this.bufferPosition = bufferPosition;
    }
    
    public int getBufferPosition()
    {
      return bufferPosition;
    }
  }
}

/* Location:
 * Qualified Name:     jline.ArgumentCompletor
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.io.IOException;
import java.util.List;

public class CandidateCycleCompletionHandler
  implements CompletionHandler
{
  public boolean complete(ConsoleReader reader, List candidates, int position)
    throws IOException
  {
    throw new IllegalStateException("CandidateCycleCompletionHandler unimplemented");
  }
}

/* Location:
 * Qualified Name:     jline.CandidateCycleCompletionHandler
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Set;

public class CandidateListCompletionHandler
  implements CompletionHandler
{
  private static ResourceBundle loc = ResourceBundle.getBundle(CandidateListCompletionHandler.class.getName());
  private boolean eagerNewlines = true;
  
  public void setAlwaysIncludeNewline(boolean eagerNewlines)
  {
    this.eagerNewlines = eagerNewlines;
  }
  
  public boolean complete(ConsoleReader reader, List candidates, int pos)
    throws IOException
  {
    CursorBuffer buf = reader.getCursorBuffer();
    if (candidates.size() == 1)
    {
      String value = candidates.get(0).toString();
      if (value.equals(buf.toString())) {
        return false;
      }
      setBuffer(reader, value, pos);
      
      return true;
    }
    if (candidates.size() > 1)
    {
      String value = getUnambiguousCompletions(candidates);
      String bufString = buf.toString();
      setBuffer(reader, value, pos);
    }
    if (eagerNewlines) {
      reader.printNewline();
    }
    printCandidates(reader, candidates, eagerNewlines);
    
    reader.drawLine();
    
    return true;
  }
  
  public static void setBuffer(ConsoleReader reader, String value, int offset)
    throws IOException
  {
    while ((getCursorBuffercursor > offset) && (reader.backspace())) {}
    reader.putString(value);
    reader.setCursorPosition(offset + value.length());
  }
  
  public static final void printCandidates(ConsoleReader reader, Collection candidates, boolean eagerNewlines)
    throws IOException
  {
    Set distinct = new HashSet(candidates);
    if (distinct.size() > reader.getAutoprintThreshhold())
    {
      if (!eagerNewlines) {
        reader.printNewline();
      }
      reader.printString(MessageFormat.format(loc.getString("display-candidates"), new Object[] { new Integer(candidates.size()) }) + " ");
      
      reader.flushConsole();
      
      String noOpt = loc.getString("display-candidates-no");
      String yesOpt = loc.getString("display-candidates-yes");
      int c;
      while ((c = reader.readCharacter(new char[] { yesOpt.charAt(0), noOpt.charAt(0) })) != -1)
      {
        if (noOpt.startsWith(new String(new char[] { (char)c })))
        {
          reader.printNewline();
          return;
        }
        if (yesOpt.startsWith(new String(new char[] { (char)c }))) {
          break;
        }
        reader.beep();
      }
    }
    if (distinct.size() != candidates.size())
    {
      Collection copy = new ArrayList();
      for (Iterator i = candidates.iterator(); i.hasNext();)
      {
        Object next = i.next();
        if (!copy.contains(next)) {
          copy.add(next);
        }
      }
      candidates = copy;
    }
    reader.printNewline();
    reader.printColumns(candidates);
  }
  
  private final String getUnambiguousCompletions(List candidates)
  {
    if ((candidates == null) || (candidates.size() == 0)) {
      return null;
    }
    String[] strings = (String[])candidates.toArray(new String[candidates.size()]);
    
    String first = strings[0];
    StringBuffer candidate = new StringBuffer();
    for (int i = 0; i < first.length(); i++)
    {
      if (!startsWith(first.substring(0, i + 1), strings)) {
        break;
      }
      candidate.append(first.charAt(i));
    }
    return candidate.toString();
  }
  
  private final boolean startsWith(String starts, String[] candidates)
  {
    for (int i = 0; i < candidates.length; i++) {
      if (!candidates[i].startsWith(starts)) {
        return false;
      }
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     jline.CandidateListCompletionHandler
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.io.File;
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLConnection;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import javax.swing.JFrame;

public class ClassNameCompletor
  extends SimpleCompletor
{
  public ClassNameCompletor()
    throws IOException
  {
    this(null);
  }
  
  public ClassNameCompletor(SimpleCompletor.SimpleCompletorFilter filter)
    throws IOException
  {
    super(getClassNames(), filter);
    setDelimiter(".");
  }
  
  public static String[] getClassNames()
    throws IOException
  {
    Set urls = new HashSet();
    for (ClassLoader loader = ClassNameCompletor.class.getClassLoader(); loader != null; loader = loader.getParent()) {
      if ((loader instanceof URLClassLoader)) {
        urls.addAll(Arrays.asList(((URLClassLoader)loader).getURLs()));
      }
    }
    Class[] systemClasses = { String.class, JFrame.class };
    for (int i = 0; i < systemClasses.length; i++)
    {
      URL classURL = systemClasses[i].getResource("/" + systemClasses[i].getName().replace('.', '/') + ".class");
      if (classURL != null)
      {
        URLConnection uc = classURL.openConnection();
        if ((uc instanceof JarURLConnection)) {
          urls.add(((JarURLConnection)uc).getJarFileURL());
        }
      }
    }
    Set classes = new HashSet();
    for (Iterator i = urls.iterator(); i.hasNext();)
    {
      URL url = (URL)i.next();
      File file = new File(url.getFile());
      if (file.isDirectory())
      {
        Set files = getClassFiles(file.getAbsolutePath(), new HashSet(), file, new int[] { 200 });
        
        classes.addAll(files);
      }
      else if ((file != null) && (file.isFile()) && 
      
        (file.toString().endsWith(".jar")))
      {
        JarFile jf = new JarFile(file);
        for (e = jf.entries(); e.hasMoreElements();)
        {
          JarEntry entry = (JarEntry)e.nextElement();
          if (entry != null)
          {
            String name = entry.getName();
            if (name.endsWith(".class")) {
              classes.add(name);
            }
          }
        }
      }
    }
    Enumeration e;
    Set classNames = new TreeSet();
    for (Iterator i = classes.iterator(); i.hasNext();)
    {
      String name = (String)i.next();
      classNames.add(name.replace('/', '.').substring(0, name.length() - 6));
    }
    return (String[])classNames.toArray(new String[classNames.size()]);
  }
  
  private static Set getClassFiles(String root, Set holder, File directory, int[] maxDirectories)
  {
    int tmp2_1 = 0; int[] tmp2_0 = maxDirectories; int tmp4_3 = tmp2_0[tmp2_1];tmp2_0[tmp2_1] = (tmp4_3 - 1);
    if (tmp4_3 < 0) {
      return holder;
    }
    File[] files = directory.listFiles();
    for (int i = 0; (files != null) && (i < files.length); i++)
    {
      String name = files[i].getAbsolutePath();
      if (name.startsWith(root)) {
        if (files[i].isDirectory()) {
          getClassFiles(root, holder, files[i], maxDirectories);
        } else if (files[i].getName().endsWith(".class")) {
          holder.add(files[i].getAbsolutePath().substring(root.length() + 1));
        }
      }
    }
    return holder;
  }
}

/* Location:
 * Qualified Name:     jline.ClassNameCompletor
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.io.IOException;
import java.util.List;

public abstract interface CompletionHandler
{
  public abstract boolean complete(ConsoleReader paramConsoleReader, List paramList, int paramInt)
    throws IOException;
}

/* Location:
 * Qualified Name:     jline.CompletionHandler
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.util.List;

public abstract interface Completor
{
  public abstract int complete(String paramString, int paramInt, List paramList);
}

/* Location:
 * Qualified Name:     jline.Completor
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

public abstract interface ConsoleOperations
{
  public static final String CR = System.getProperty("line.separator");
  public static final char BACKSPACE = '\b';
  public static final char RESET_LINE = '\r';
  public static final char KEYBOARD_BELL = '\007';
  public static final char CTRL_A = '\001';
  public static final char CTRL_B = '\002';
  public static final char CTRL_C = '\003';
  public static final char CTRL_D = '\004';
  public static final char CTRL_E = '\005';
  public static final char CTRL_F = '\006';
  public static final char CTRL_G = '\007';
  public static final char CTRL_K = '\013';
  public static final char CTRL_L = '\f';
  public static final char CTRL_N = '\016';
  public static final char CTRL_P = '\020';
  public static final char CTRL_OB = '\033';
  public static final char DELETE = '';
  public static final char CTRL_QM = '';
  public static final short UNKNOWN = -99;
  public static final short MOVE_TO_BEG = -1;
  public static final short MOVE_TO_END = -3;
  public static final short PREV_CHAR = -4;
  public static final short NEWLINE = -6;
  public static final short KILL_LINE = -7;
  public static final short CLEAR_SCREEN = -8;
  public static final short NEXT_HISTORY = -9;
  public static final short PREV_HISTORY = -11;
  public static final short REDISPLAY = -13;
  public static final short KILL_LINE_PREV = -15;
  public static final short DELETE_PREV_WORD = -16;
  public static final short NEXT_CHAR = -19;
  public static final short REPEAT_PREV_CHAR = -20;
  public static final short SEARCH_PREV = -21;
  public static final short REPEAT_NEXT_CHAR = -24;
  public static final short SEARCH_NEXT = -25;
  public static final short PREV_SPACE_WORD = -27;
  public static final short TO_END_WORD = -29;
  public static final short REPEAT_SEARCH_PREV = -34;
  public static final short PASTE_PREV = -36;
  public static final short REPLACE_MODE = -37;
  public static final short SUBSTITUTE_LINE = -38;
  public static final short TO_PREV_CHAR = -39;
  public static final short NEXT_SPACE_WORD = -40;
  public static final short DELETE_PREV_CHAR = -41;
  public static final short ADD = -42;
  public static final short PREV_WORD = -43;
  public static final short CHANGE_META = -44;
  public static final short DELETE_META = -45;
  public static final short END_WORD = -46;
  public static final short INSERT = -48;
  public static final short REPEAT_SEARCH_NEXT = -49;
  public static final short PASTE_NEXT = -50;
  public static final short REPLACE_CHAR = -51;
  public static final short SUBSTITUTE_CHAR = -52;
  public static final short TO_NEXT_CHAR = -53;
  public static final short UNDO = -54;
  public static final short NEXT_WORD = -55;
  public static final short DELETE_NEXT_CHAR = -56;
  public static final short CHANGE_CASE = -57;
  public static final short COMPLETE = -58;
  public static final short EXIT = -59;
  public static final short PASTE = -60;
  public static final short START_OF_HISTORY = -61;
  public static final short END_OF_HISTORY = -62;
  public static final short CLEAR_LINE = -63;
  public static final short ABORT = -64;
}

/* Location:
 * Qualified Name:     jline.ConsoleOperations
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package jline;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;

public class ConsoleReader
  implements ConsoleOperations
{
  static final int TAB_WIDTH = 4;
  String prompt;
  private boolean useHistory = true;
  private boolean usePagination = false;
  public static final String CR = System.getProperty("line.separator");
  private static ResourceBundle loc = ResourceBundle.getBundle(CandidateListCompletionHandler.class.getName());
  public static SortedMap KEYMAP_NAMES;
  private final short[] keybindings;
  
  static
  {
    Map names = new TreeMap();
    
    names.put("MOVE_TO_BEG", new Short((short)-1));
    names.put("MOVE_TO_END", new Short((short)-3));
    names.put("PREV_CHAR", new Short((short)-4));
    names.put("NEWLINE", new Short((short)-6));
    names.put("KILL_LINE", new Short((short)-7));
    names.put("PASTE", new Short((short)-60));
    names.put("CLEAR_SCREEN", new Short((short)-8));
    names.put("NEXT_HISTORY", new Short((short)-9));
    names.put("PREV_HISTORY", new Short((short)-11));
    names.put("START_OF_HISTORY", new Short((short)-61));
    names.put("END_OF_HISTORY", new Short((short)-62));
    names.put("REDISPLAY", new Short((short)-13));
    names.put("KILL_LINE_PREV", new Short((short)-15));
    names.put("DELETE_PREV_WORD", new Short((short)-16));
    names.put("NEXT_CHAR", new Short((short)-19));
    names.put("REPEAT_PREV_CHAR", new Short((short)-20));
    names.put("SEARCH_PREV", new Short((short)-21));
    names.put("REPEAT_NEXT_CHAR", new Short((short)-24));
    names.put("SEARCH_NEXT", new Short((short)-25));
    names.put("PREV_SPACE_WORD", new Short((short)-27));
    names.put("TO_END_WORD", new Short((short)-29));
    names.put("REPEAT_SEARCH_PREV", new Short((short)-34));
    names.put("PASTE_PREV", new Short((short)-36));
    names.put("REPLACE_MODE", new Short((short)-37));
    names.put("SUBSTITUTE_LINE", new Short((short)-38));
    names.put("TO_PREV_CHAR", new Short((short)-39));
    names.put("NEXT_SPACE_WORD", new Short((short)-40));
    names.put("DELETE_PREV_CHAR", new Short((short)-41));
    names.put("ADD", new Short((short)-42));
    names.put("PREV_WORD", new Short((short)-43));
    names.put("CHANGE_META", new Short((short)-44));
    names.put("DELETE_META", new Short((short)-45));
    names.put("END_WORD", new Short((short)-46));
    names.put("NEXT_CHAR", new Short((short)-19));
    names.put("INSERT", new Short((short)-48));
    names.put("REPEAT_SEARCH_NEXT", new Short((short)-49));
    names.put("PASTE_NEXT", new Short((short)-50));
    names.put("REPLACE_CHAR", new Short((short)-51));
    names.put("SUBSTITUTE_CHAR", new Short((short)-52));
    names.put("TO_NEXT_CHAR", new Short((short)-53));
    names.put("UNDO", new Short((short)-54));
    names.put("NEXT_WORD", new Short((short)-55));
    names.put("DELETE_NEXT_CHAR", new Short((short)-56));
    names.put("CHANGE_CASE", new Short((short)-57));
    names.put("COMPLETE", new Short((short)-58));
    names.put("EXIT", new Short((short)-59));
    names.put("CLEAR_LINE", new Short((short)-63));
    names.put("ABORT", new Short((short)-64));
    
    KEYMAP_NAMES = new TreeMap(Collections.unmodifiableMap(names));
  }
  
  private boolean bellEnabled = true;
  private Character mask = null;
  private static final Character NULL_MASK = new Character('\000');
  private int autoprintThreshhold = Integer.getInteger("jline.completion.threshold", 100).intValue();
  private final Terminal terminal;
  private CompletionHandler completionHandler = new CandidateListCompletionHandler();
  InputStream in;
  final Writer out;
  final CursorBuffer buf = new CursorBuffer();
  static PrintWriter debugger;
  History history = new History();
  final List completors = new LinkedList();
  private Character echoCharacter = null;
  private Map triggeredActions = new HashMap();
  private StringBuffer searchTerm = null;
  private String previousSearchTerm = "";
  private int searchIndex = -1;
  
  public void addTriggeredAction(char c, ActionListener listener)
  {
    triggeredActions.put(new Character(c), listener);
  }
  
  public ConsoleReader()
    throws IOException
  {
    this(new FileInputStream(FileDescriptor.in), new PrintWriter(new OutputStreamWriter(System.out, System.getProperty("jline.WindowsTerminal.output.encoding", System.getProperty("file.encoding")))));
  }
  
  public ConsoleReader(InputStream in, Writer out)
    throws IOException
  {
    this(in, out, null);
  }
  
  public ConsoleReader(InputStream in, Writer out, InputStream bindings)
    throws IOException
  {
    this(in, out, bindings, Terminal.getTerminal());
  }
  
  public ConsoleReader(InputStream in, Writer out, InputStream bindings, Terminal term)
    throws IOException
  {
    terminal = term;
    setInput(in);
    this.out = out;
    if (bindings == null) {
      try
      {
        String bindingFile = System.getProperty("jline.keybindings", new File(System.getProperty("user.home"), ".jlinebindings.properties").getAbsolutePath());
        if (new File(bindingFile).isFile()) {
          bindings = new FileInputStream(new File(bindingFile));
        }
      }
      catch (Exception e)
      {
        if (debugger != null) {
          e.printStackTrace(debugger);
        }
      }
    }
    if (bindings == null) {
      bindings = terminal.getDefaultBindings();
    }
    keybindings = new short[131070];
    
    Arrays.fill(keybindings, (short)-99);
    Properties p;
    Iterator i;
    if (bindings != null)
    {
      p = new Properties();
      p.load(bindings);
      bindings.close();
      for (i = p.keySet().iterator(); i.hasNext();)
      {
        String val = (String)i.next();
        try
        {
          Short code = new Short(val);
          String op = p.getProperty(val);
          
          Short opval = (Short)KEYMAP_NAMES.get(op);
          if (opval != null) {
            keybindings[code.shortValue()] = opval.shortValue();
          }
        }
        catch (NumberFormatException nfe)
        {
          consumeException(nfe);
        }
      }
    }
  }
  
  public Terminal getTerminal()
  {
    return terminal;
  }
  
  public void setDebug(PrintWriter debugger)
  {
    debugger = debugger;
  }
  
  public void setInput(InputStream in)
  {
    this.in = in;
  }
  
  public InputStream getInput()
  {
    return in;
  }
  
  public String readLine()
    throws IOException
  {
    return readLine((String)null);
  }
  
  public String readLine(Character mask)
    throws IOException
  {
    return readLine(null, mask);
  }
  
  public void setBellEnabled(boolean bellEnabled)
  {
    this.bellEnabled = bellEnabled;
  }
  
  public boolean getBellEnabled()
  {
    return bellEnabled;
  }
  
  public int getTermwidth()
  {
    return getTerminal().getTerminalWidth();
  }
  
  public int getTermheight()
  {
    return getTerminal().getTerminalHeight();
  }
  
  public void setAutoprintThreshhold(int autoprintThreshhold)
  {
    this.autoprintThreshhold = autoprintThreshhold;
  }
  
  public int getAutoprintThreshhold()
  {
    return autoprintThreshhold;
  }
  
  int getKeyForAction(short logicalAction)
  {
    for (int i = 0; i < keybindings.length; i++) {
      if (keybindings[i] == logicalAction) {
        return i;
      }
    }
    return -1;
  }
  
  int clearEcho(int c)
    throws IOException
  {
    if (!terminal.getEcho()) {
      return 0;
    }
    int num = countEchoCharacters((char)c);
    back(num);
    drawBuffer(num);
    
    return num;
  }
  
  int countEchoCharacters(char c)
  {
    if (c == '\t')
    {
      int tabstop = 8;
      int position = getCursorPosition();
      
      return tabstop - position % tabstop;
    }
    return getPrintableCharacters(c).length();
  }
  
  StringBuffer getPrintableCharacters(char ch)
  {
    StringBuffer sbuff = new StringBuffer();
    if (ch >= ' ')
    {
      if (ch < '')
      {
        sbuff.append(ch);
      }
      else if (ch == '')
      {
        sbuff.append('^');
        sbuff.append('?');
      }
      else
      {
        sbuff.append('M');
        sbuff.append('-');
        if (ch >= '�')
        {
          if (ch < '�')
          {
            sbuff.append((char)(ch - '?'));
          }
          else
          {
            sbuff.append('^');
            sbuff.append('?');
          }
        }
        else
        {
          sbuff.append('^');
          sbuff.append((char)(ch - '?' + 64));
        }
      }
    }
    else
    {
      sbuff.append('^');
      sbuff.append((char)(ch + '@'));
    }
    return sbuff;
  }
  
  int getCursorPosition()
  {
    return getStrippedAnsiLength(prompt) + buf.cursor;
  }
  
  int getStrippedAnsiLength(String ansiString)
  {
    if (ansiString == null) {
      return 0;
    }
    boolean inAnsi = false;
    int strippedLength = 0;
    char[] chars = ansiString.toCharArray();
    for (int i = 0; i < chars.length; i++)
    {
      char c = chars[i];
      if ((!inAnsi) && (c == '\033') && (i < chars.length - 1) && (chars[(i + 1)] == '['))
      {
        i++;
        inAnsi = true;
      }
      else if (inAnsi)
      {
        if (('@' <= c) && (c <= '~')) {
          inAnsi = false;
        }
      }
      else
      {
        strippedLength++;
      }
    }
    return strippedLength;
  }
  
  public String readLine(String prompt)
    throws IOException
  {
    return readLine(prompt, null);
  }
  
  public void setDefaultPrompt(String prompt)
  {
    this.prompt = prompt;
  }
  
  public String getDefaultPrompt()
  {
    return prompt;
  }
  
  private String readLine(InputStream in)
    throws IOException
  {
    StringBuffer buf = new StringBuffer();
    for (;;)
    {
      int i = in.read();
      if ((i == -1) || (i == 10) || (i == 13)) {
        return buf.toString();
      }
      buf.ap
1 2 3 4

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd