Package jline

Class CursorBuffer


  • public class CursorBuffer
    extends java.lang.Object
    A CursorBuffer is a holder for a StringBuffer that also contains the current cursor position.
    Author:
    Marc Prud'hommeaux
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int cursor  
    • Constructor Summary

      Constructors 
      Constructor Description
      CursorBuffer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean clearBuffer()  
      char current()  
      java.lang.StringBuffer getBuffer()  
      boolean isOvertyping()  
      int length()  
      void setBuffer​(java.lang.StringBuffer buffer)  
      void setOvertyping​(boolean b)  
      java.lang.String toString()  
      void write​(char c)
      Write the specific character into the buffer, setting the cursor position ahead one.
      void write​(java.lang.String str)
      Insert the specified String into the buffer, setting the cursor to the end of the insertion point.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

    • Method Detail

      • length

        public int length()
      • write

        public void write​(char c)
        Write the specific character into the buffer, setting the cursor position ahead one. The text may overwrite or insert based on the current setting of isOvertyping().
        Parameters:
        c - the character to insert
      • write

        public void write​(java.lang.String str)
        Insert the specified String into the buffer, setting the cursor to the end of the insertion point.
        Parameters:
        str - the String to insert. Must not be null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getBuffer

        public java.lang.StringBuffer getBuffer()
      • setBuffer

        public void setBuffer​(java.lang.StringBuffer buffer)