Logo Search packages:      
Sourcecode: jline version File versions  Download package

final String jline::ConsoleReader::finishBuffer (  )  [inline, package]

Clear the buffer and add its contents to the history.

Returns:
the former contents of the buffer.

Definition at line 1024 of file ConsoleReader.java.

References jline::History::addToHistory(), mask, and jline::History::moveToEnd().

Referenced by readLine().

      {
            String str = buf.buffer.toString ();

            // we only add it to the history if the buffer is not empty
            // and if mask is null, since having a mask typically means
            // the string was a password. We clear the mask after this call
            if (str.length () > 0)
            {
                  if (mask == null) 
                  {
                        history.addToHistory (str);
                  }
                  else 
                  {
                        mask = null;
                  }
            }
            
            history.moveToEnd ();

            buf.buffer.setLength (0);
            buf.cursor = 0;
            return str;
      }


Generated by  Doxygen 1.6.0   Back to index