1 /*
   2  * Copyright (c) 2002-2017, the original author or authors.
   3  *
   4  * This software is distributable under the BSD license. See the terms of the
   5  * BSD license in the documentation provided with this software.
   6  *
   7  * http://www.opensource.org/licenses/bsd-license.php
   8  */
   9 package jdk.internal.org.jline.reader;
  10 
  11 public interface Buffer {
  12 
  13     /*
  14      * Read access
  15      */
  16 
  17     int cursor();
  18 
  19     int atChar(int i);
  20 
  21     int length();
  22 
  23     int currChar();
  24 
  25     int prevChar();
  26 
  27     int nextChar();
  28 
  29     /*
  30      * Movement
  31      */
  32 
  33     boolean cursor(int position);
  34 
  35     int move(int num);
  36 
  37     boolean up();
  38 
  39     boolean down();
  40 
  41     boolean moveXY(int dx, int dy);
  42 
  43     /*
  44      * Modification
  45      */
  46 
  47     boolean clear();
  48 
  49     boolean currChar(int c);
  50 
  51     void write(int c);
  52 
  53     void write(int c, boolean overTyping);
  54 
  55     void write(CharSequence str);
  56 
  57     void write(CharSequence str, boolean overTyping);
  58 
  59     boolean backspace();
  60 
  61     int backspace(int num);
  62 
  63     boolean delete();
  64 
  65     int delete(int num);
  66 
  67     /*
  68      * String
  69      */
  70 
  71     String substring(int start);
  72 
  73     String substring(int start, int end);
  74 
  75     String upToCursor();
  76 
  77     String toString();
  78 
  79     /*
  80      * Copy
  81      */
  82 
  83     Buffer copy();
  84 
  85     void copyFrom(Buffer buffer);
  86 
  87 }