/** * Whether or not to allow the use of the JNI console interaction. */ public void setDirectConsole(final boolean flag) { this.directConsole = flag; Log.debug("Direct console: ", flag); }
protected synchronized void setAnsiSupported(final boolean supported) { this.ansiSupported = supported; Log.debug("Ansi supported: ", supported); }
public synchronized void setEchoEnabled(final boolean enabled) { this.echoEnabled = enabled; Log.debug("Echo enabled: ", enabled); }
private static void removeHook(final Thread thread) { Log.debug("Removing shutdown-hook: ", thread); try { Runtime.getRuntime().removeShutdownHook(thread); } catch (AbstractMethodError e) { // JDK 1.3+ only method. Bummer. Log.debug("Failed to remove shutdown-hook", e); } catch (IllegalStateException e) { // The VM is shutting down, not a big deal; ignore } }
/** * @since 2.7 */ public static void reset() { Log.debug("Resetting"); properties = null; // force new properties to load getProperties(); }
private static void loadProperties(final URL url, final Properties props) throws IOException { Log.debug("Loading properties from: ", url); InputStream input = url.openStream(); try { props.load(new BufferedInputStream(input)); } finally { try { input.close(); } catch (IOException e) { // ignore } } if (Log.DEBUG) { Log.debug("Loaded properties:"); for (Map.Entry<Object,Object> entry : props.entrySet()) { Log.debug(" ", entry.getKey(), "=", entry.getValue()); } } }
private static synchronized void runTasks() { Log.debug("Running all shutdown-hook tasks"); // Iterate through copy of tasks list for (Task task : tasks.toArray(new Task[tasks.size()])) { Log.debug("Running task: ", task); try { task.run(); } catch (Throwable e) { Log.warn("Task failed", e); } } tasks.clear(); }
private boolean fetchConfig(String name) { long currentTime = System.currentTimeMillis(); try { // tty properties are cached so we don't have to worry too much about getting term width/height if (config == null || currentTime - configLastFetched > 1000) { config = get("-a"); } } catch (Exception e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } Log.debug("Failed to query stty ", name, "\n", e); if (config == null) { return false; } } // always update the last fetched time and try to parse the output if (currentTime - configLastFetched > 1000) { configLastFetched = currentTime; } return true; }
public static synchronized <T extends Task> T add(final T task) { checkNotNull(task); // If not enabled ignore if (!enabled) { Log.debug("Shutdown-hook is disabled; not installing: ", task); return task; } // Install the hook thread if needed if (hook == null) { hook = addHook(new Thread("JLine Shutdown Hook") { @Override public void run() { runTasks(); } }); } // Track the task Log.debug("Adding shutdown-hook task: ", task); tasks.add(task); return task; }
@Override public String getOutputEncoding() { int codepage = getConsoleOutputCodepage(); //http://docs.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html String charsetMS = "ms" + codepage; if (java.nio.charset.Charset.isSupported(charsetMS)) { return charsetMS; } String charsetCP = "cp" + codepage; if (java.nio.charset.Charset.isSupported(charsetCP)) { return charsetCP; } Log.debug("can't figure out the Java Charset of this code page (" + codepage + ")..."); return super.getOutputEncoding(); }
private TerminalLineSettings(String ttyDevice, boolean unused) throws IOException, InterruptedException { checkNotNull(ttyDevice); this.sttyCommand = Configuration.getString(JLINE_STTY, DEFAULT_STTY); this.shCommand = Configuration.getString(JLINE_SH, DEFAULT_SH); this.ttyDevice = ttyDevice; this.useRedirect = SUPPORTS_REDIRECT && DEFAULT_TTY.equals(ttyDevice); this.initialConfig = get("-g").trim(); this.config = get("-a"); this.configLastFetched = System.currentTimeMillis(); Log.debug("Config: ", config); // sanity check if (config.length() == 0) { throw new IOException(MessageFormat.format("Unrecognized stty code: {0}", config)); } }
protected void loadKeys(String appName, URL inputrcUrl) { keys = keyMaps.get(KeyMap.EMACS); try { InputStream input = inputrcUrl.openStream(); try { loadKeys(input, appName); Log.debug("Loaded user configuration: ", inputrcUrl); } finally { try { input.close(); } catch (IOException e) { // Ignore } } } catch (IOException e) { if (inputrcUrl.getProtocol().equals("file")) { File file = new File(inputrcUrl.getPath()); if (file.exists()) { Log.warn("Unable to read user configuration: ", inputrcUrl, e); } } else { Log.warn("Unable to read user configuration: ", inputrcUrl, e); } } }
events = WindowsSupport.readConsoleInput(1); } catch (IOException e) { Log.debug("read Windows console input error: ", e);
private static Properties initProperties() { URL url = determineUrl(); Properties props = new Properties(); try { loadProperties(url, props); } catch (FileNotFoundException e) { // debug here and no stack trace, as this can happen normally if default jline.rc file is missing Log.debug("Unable to read configuration: ", e.toString()); } catch (IOException e) { Log.warn("Unable to read configuration from: ", url, e); } return props; }
Log.debug("Max width: ", maxWidth);
/** * Whether or not to allow the use of the JNI console interaction. */ public void setDirectConsole(final boolean flag) { this.directConsole = flag; Log.debug("Direct console: ", flag); }
/** * @since 2.7 */ public static void reset() { Log.debug("Resetting"); properties = null; // force new properties to load getProperties(); }