1 /* 2 * Copyright (c) 2002-2012, 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.jline.console; 10 11 /** 12 * This exception is thrown by {@link ConsoleReader#readLine} when 13 * user interrupt handling is enabled and the user types the 14 * interrupt character (ctrl-C). The partially entered line is 15 * available via the {@link #getPartialLine()} method. 16 */ 17 public class UserInterruptException 18 extends RuntimeException 19 { 20 private static final long serialVersionUID = 6172232572140736750L; 21 22 private final String partialLine; 23 24 public UserInterruptException(String partialLine) 25 { 26 this.partialLine = partialLine; 27 } 28 29 /** 30 * @return the partially entered line when ctrl-C was pressed 31 */ 32 public String getPartialLine() 33 { 34 return partialLine; 35 } 36 }