code: @Override
      public void insert(char[] text) throws IOException
      {
          int ln = text.length;
          if (ln == 0)
          {
              return;
          }
          if (ln >= size - (end-cursor))
          {
              throw new IOException(Arrays.toString(text)+" doesn't fit in the buffer");
          }
          if (cursor != end)
          {
              makeRoom(ln);
          }
          if (array != null)
          {
              int cms = (int) (cursor % size);
              if (size - cms < text.length)
              {
                  System.arraycopy(text, 0, array, cms, size - cms);
                  System.arraycopy(text, size - cms, array, 0, text.length - (size - cms));
              }
              else
              {
                  System.arraycopy(text, 0, array, cms, text.length);
              }
          }
          else
          {
              for (int ii=0;ii<ln;ii++)
              {
                  set(cursor+ii, text[ii]);
              }
          }
          end += ln;
      }
docs: Inserts text at cursor position
  @param text
  @throws java.io.IOException