code: private void replaceCommandLine(String replacement) {
  		int currentCLSize = commandLineBuffer.size();
  		commandLineBuffer = new ByteArrayOutputStream();
  		for (int x = 0; x < replacement.length(); x++) {
  			commandLineBuffer.write(replacement.charAt(x));
  		}
  		String replaceString = '\r' + promptStr;
  		for (int x = 0; x <= currentCLSize; x++) {
  			replaceString += ' ';
  		}
  		replaceString += '\r' + promptStr + replacement;
  		ps.print(replaceString);
  	}
docs: Replaces the current command line on the telnet client with another one.
  
  @param replacement