public void load(final File file) throws IOException { checkNotNull(file); if (file.exists()) { Log.trace("Loading history from: ", file); FileReader reader = null; try{ reader = new FileReader(file); load(reader); } finally{ if(reader != null){ reader.close(); } } } }
public void purge() throws IOException { Log.trace("Purging history"); clear(); if (!file.delete()) { Log.warn("Failed to delete history file: ", file); } } }
public void flush() throws IOException { Log.trace("Flushing history"); if (!file.exists()) { File dir = file.getParentFile(); if (!dir.exists() && !dir.mkdirs()) { Log.warn("Failed to create directory: ", dir); } if (!file.createNewFile()) { Log.warn("Failed to create file: ", file); } } PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(file))); try { for (Entry entry : this) { out.println(entry.value()); } } finally { out.close(); } }
private String exec(final String... cmd) throws IOException, InterruptedException { checkNotNull(cmd); Log.trace("Running: ", cmd); Process p = null; if (useRedirect) { try { p = inheritInput(new ProcessBuilder(cmd)).start(); } catch (Throwable t) { useRedirect = false; } } if (p == null) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < cmd.length; i++) { if (i > 0) { sb.append(' '); } sb.append(cmd[i]); } sb.append(" < "); sb.append(ttyDevice); p = new ProcessBuilder(shCommand, "-c", sb.toString()).start(); } String result = waitAndCapture(p); Log.trace("Result: ", result); return result; }
int c = reader.read(); if (c >= 0) { Log.trace("Keystroke: ", c);
public static synchronized Terminal create(String ttyDevice) { if (Log.TRACE) { Log.trace(new Throwable("CREATE MARKER"));
Log.trace("Completing ", buffer, " (pos=", cursor, ") with: ", candidates, ": offset=", pos);
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
public void flush() throws IOException { Log.trace("Flushing history"); try (PrintStream out = new PrintStream(reg.getOutputStream(loc, false))) { for (Entry entry : this) { out.println(entry.value()); } } }
public void purge() throws IOException { Log.trace("Purging history"); clear(); if (!file.delete()) { Log.warn("Failed to delete history file: ", file); } } }
public void load(final File file) throws IOException { checkNotNull(file); if (file.exists()) { Log.trace("Loading history from: ", file); FileReader reader = null; try{ reader = new FileReader(file); load(reader); } finally{ if(reader != null){ reader.close(); } } } }
public void purge() throws IOException { Log.trace("Purging history"); clear(); reg.remove(loc); }
public void flush() throws IOException { Log.trace("Flushing history"); if (!file.exists()) { File dir = file.getParentFile(); if (!dir.exists() && !dir.mkdirs()) { Log.warn("Failed to create directory: ", dir); } if (!file.createNewFile()) { Log.warn("Failed to create file: ", file); } } PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(file))); try { for (Entry entry : this) { out.println(entry.value()); } } finally { out.close(); } }
private String exec(final String... cmd) throws IOException, InterruptedException { checkNotNull(cmd); Log.trace("Running: ", cmd); Process p = null; if (useRedirect) { try { p = inheritInput(new ProcessBuilder(cmd)).start(); } catch (Throwable t) { useRedirect = false; } } if (p == null) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < cmd.length; i++) { if (i > 0) { sb.append(' '); } sb.append(cmd[i]); } sb.append(" < "); sb.append(ttyDevice); p = new ProcessBuilder(shCommand, "-c", sb.toString()).start(); } String result = waitAndCapture(p); Log.trace("Result: ", result); return result; }
int c = reader.read(); if (c >= 0) { Log.trace("Keystroke: ", c);
public void load(final ISourceLocation loc) throws IOException { checkNotNull(loc); if (reg.exists(loc)) { Log.trace("Loading history from: ", loc); load(reg.getInputStream(loc)); } }
Log.trace("Completing ", buffer, " (pos=", cursor, ") with: ", candidates, ": offset=", pos);
public static synchronized Terminal create(String ttyDevice) { if (Log.TRACE) { Log.trace(new Throwable("CREATE MARKER"));
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }