Class LineEditor


  • public class LineEditor
    extends AbstractEditor
    Since it is close to impossible to get consistent behavior at the command line between different JVM hosts, the only reasonable way to edit things at the command line is going to be with some form of line editor. Rather than be clever and create one, this is a basic port of the tried and true Unix line editor, ed.

    Usage

    You use this by creating an instance with either a buffer of lines or a string which is parsed simply into lines (this is not perfect since there can be some cross-platform issues -- better to roll it yourself). You then invoke execute() and this runs the editor. When done, this method exist and you check the isSaved() flag. If true, then the user saved the buffer and wants to keep it, so you can either get the buffer and process the lines or invoke the bufferToString() method.

    Created by Jeff Gaynor
    on 8/30/18 at 11:23 AM