/** * Gets the relative name to this item from the specified group. * * @param g * The {@link ItemGroup} instance used as context to evaluate the relative name of this item * @return * The name of the current item, relative to p. Nested {@link ItemGroup}s are separated by {@code /} character. * @since 1.419 * @return * String like "../foo/bar". * {@code null} if one of item parents is not an {@link Item}. */ @Nullable default String getRelativeNameFrom(@CheckForNull ItemGroup g) { return Functions.getRelativeNameFrom(this, g); }
/** * Short for {@code getRelativeNameFrom(item.getParent())} * * @return String like "../foo/bar". * {@code null} if one of item parents is not an {@link Item}. * @since 1.419 */ @Nullable default String getRelativeNameFrom(@Nonnull Item item) { return getRelativeNameFrom(item.getParent()); }
public ConsoleReader(final @Nullable String appName, final InputStream in, final OutputStream out, final @Nullable Terminal term, final @Nullable String encoding) throws IOException { this.appName = appName != null ? appName : "JLine"; this.encoding = encoding != null ? encoding : Configuration.getEncoding(); Terminal terminal = term != null ? term : TerminalFactory.get(); this.terminal = terminal instanceof Terminal2 ? (Terminal2) terminal : new DefaultTerminal2(terminal); String outEncoding = terminal.getOutputEncoding() != null? terminal.getOutputEncoding() : this.encoding; this.out = new OutputStreamWriter(terminal.wrapOutIfNeeded(out), outEncoding); setInput( in ); this.inputrcUrl = getInputRc(); consoleKeys = new ConsoleKeys(this.appName, inputrcUrl); if (terminal instanceof UnixTerminal && TerminalLineSettings.DEFAULT_TTY.equals(((UnixTerminal) terminal).getSettings().getTtyDevice()) && Configuration.getBoolean("jline.sigcont", false)) { setupSigCont(); } }
@Nullable public Dinosaur getDinosaur() { return this.dinosaur; } }
public ConsoleReader(final @Nullable String appName, final InputStream in, final OutputStream out, final @Nullable Terminal term, final @Nullable String encoding) throws IOException { this.appName = appName != null ? appName : "JLine"; this.encoding = encoding != null ? encoding : Configuration.getEncoding(); Terminal terminal = term != null ? term : TerminalFactory.get(); this.terminal = terminal instanceof Terminal2 ? (Terminal2) terminal : new DefaultTerminal2(terminal); String outEncoding = terminal.getOutputEncoding() != null? terminal.getOutputEncoding() : this.encoding; this.out = new OutputStreamWriter(terminal.wrapOutIfNeeded(out), outEncoding); setInput( in ); this.inputrcUrl = getInputRc(); consoleKeys = new ConsoleKeys(this.appName, inputrcUrl); if (terminal instanceof UnixTerminal && TerminalLineSettings.DEFAULT_TTY.equals(((UnixTerminal) terminal).getSettings().getTtyDevice()) && Configuration.getBoolean("jline.sigcont", false)) { setupSigCont(); } }