Package jline.console

Class CursorBuffer


  • public class CursorBuffer
    extends java.lang.Object
    A holder for a StringBuilder that also contains the current cursor position.
    Since:
    2.0
    Author:
    Marc Prud'hommeaux, Jason Dillon
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.StringBuilder buffer  
      int cursor  
    • Constructor Summary

      Constructors 
      Constructor Description
      CursorBuffer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean clear()  
      CursorBuffer copy()  
      char current()  
      boolean isOverTyping()  
      int length()  
      char nextChar()  
      void setOverTyping​(boolean b)  
      java.lang.String toString()  
      java.lang.String upToCursor()  
      void write​(char c)
      Write the specific character into the buffer, setting the cursor position ahead one.
      void write​(java.lang.CharSequence str)
      Insert the specified chars 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

      • cursor

        public int cursor
      • buffer

        public final java.lang.StringBuilder buffer
    • Constructor Detail

      • CursorBuffer

        public CursorBuffer()
    • Method Detail

      • isOverTyping

        public boolean isOverTyping()
      • setOverTyping

        public void setOverTyping​(boolean b)
      • length

        public int length()
      • nextChar

        public char nextChar()
      • current

        public char current()
      • 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.CharSequence str)
        Insert the specified chars into the buffer, setting the cursor to the end of the insertion point.
      • clear

        public boolean clear()
      • upToCursor

        public java.lang.String upToCursor()
      • toString

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