jline.console.completer
Class FileNameCompleter

java.lang.Object
  extended by jline.console.completer.FileNameCompleter
All Implemented Interfaces:
Completer

public class FileNameCompleter
extends java.lang.Object
implements Completer

A file name completer takes the buffer and issues a list of potential completions.

This completer tries to behave as similar as possible to bash's file name completion (using GNU readline) with the following exceptions:

Since:
2.3
Author:
Marc Prud'hommeaux, Jason Dillon

Constructor Summary
FileNameCompleter()
           
 
Method Summary
 int complete(java.lang.String buffer, int cursor, java.util.List<java.lang.CharSequence> candidates)
          Populates candidates with a list of possible completions for the buffer.
protected  java.io.File getUserDir()
           
protected  java.io.File getUserHome()
           
protected  int matchFiles(java.lang.String buffer, java.lang.String translated, java.io.File[] files, java.util.List<java.lang.CharSequence> candidates)
           
protected  java.lang.CharSequence render(java.io.File file, java.lang.CharSequence name)
           
protected  java.lang.String separator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileNameCompleter

public FileNameCompleter()
Method Detail

complete

public int complete(java.lang.String buffer,
                    int cursor,
                    java.util.List<java.lang.CharSequence> candidates)
Description copied from interface: Completer
Populates candidates with a list of possible completions for the buffer. The candidates list will not be sorted before being displayed to the user: thus, the complete method should sort the List before returning.

Specified by:
complete in interface Completer
Parameters:
buffer - The buffer
cursor - The current position of the cursor in the buffer
candidates - The List of candidates to populate
Returns:
The index of the buffer for which the completion will be relative

separator

protected java.lang.String separator()

getUserHome

protected java.io.File getUserHome()

getUserDir

protected java.io.File getUserDir()

matchFiles

protected int matchFiles(java.lang.String buffer,
                         java.lang.String translated,
                         java.io.File[] files,
                         java.util.List<java.lang.CharSequence> candidates)

render

protected java.lang.CharSequence render(java.io.File file,
                                        java.lang.CharSequence name)


Copyright © 2008-2011 Sonatype. All Rights Reserved.