Tabnine Logo
CLIContext.getReader
Code IndexAdd Tabnine to your IDE (free)

How to use
getReader
method
in
org.jpos.q2.CLIContext

Best Java code snippets using org.jpos.q2.CLIContext.getReader (Showing top 12 results out of 315)

origin: jpos/jPOS

public boolean confirm(String prompt) {
  return "yes".equalsIgnoreCase(getReader().readLine(prompt));
}
origin: jpos/jPOS

public void print(String s) {
  if (isInteractive())
    getReader().getTerminal().writer().print(s);
  else {
    try {
      out.write(s.getBytes());
      out.flush();
    } catch (IOException ignored) {
      ignored.printStackTrace();
    }
  }
}
origin: jpos/jPOS

  public void exec(CLIContext ctx, String[] args) throws Exception {
    ctx.getReader().getTerminal().puts(InfoCmp.Capability.clear_screen);
  }
}
origin: jpos/jPOS

  public void exec(CLIContext cli, String[] args) throws Exception {
    Terminal term = cli.getReader().getTerminal();
    cli.println("TERM=" + term.getClass().getSimpleName() + "/" + term.getType());
  }
}
origin: jpos/jPOS

  public void exec(CLIContext cli, String[] args)
  {
    try
    {
      String[] params = new String[args.length - 1];
      System.arraycopy(args, 1, params, 0, params.length);
      PrintStream os = new PrintStream(cli.getReader().getTerminal().output());
      new org.jpos.security.jceadapter.Console().exec(os,os,params);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
}
origin: jpos/jPOS-EE

  private boolean unlock (CLIContext cli) throws NoSuchPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, NoSuchProviderException, InvalidKeyException {
    return cs.unlock(new SensitiveString(cli.getReader().readLine("Password: ", '*')));
  }
}
origin: jpos/jPOS-EE

  private void decrypt (CLIContext cli, String sKeyId, String cryptogram) throws Exception {
    UUID jobId = UUID.randomUUID();
    UUID keyId = UUID.fromString(sKeyId);
    byte[] cleartext;
    try {
      if (cs.isLocked()) {
        cs.loadKey(jobId, keyId, cli.getReader().readLine("Password: ", '*').toCharArray());
      }
      byte[] clearText = cs.aesDecrypt(jobId, keyId, Base64.getDecoder().decode(cryptogram));
      cli.println (ISOUtil.hexdump(clearText));
    } catch (PGPException e) {
      throw new IllegalArgumentException("Invalid password/key - " + e.getMessage());
    } finally {
      cs.unloadKey(jobId, keyId);
    }
  }
}
origin: jpos/jPOS-EE

  public void exec(CLIContext cli, String[] args) throws Exception {
    try (BinLogReader bl = new BinLogReader(new File((String) cli.getUserData().get("binlog")))) {
      while (bl.hasNext(10000L)) {
        BinLog.Entry ref = bl.next();
        cli.println(String.format("%06d@%08d %s",
         ref.ref().getFileNumber(),
         ref.ref().getOffset(),
         ISOUtil.hexdump(ref.get())));
        cli.getReader().getTerminal().flush();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
origin: jpos/jPOS

public void exec(CLIContext cli, String[] args) throws Exception {
  this.p = new PrintStream(cli.getReader().getTerminal().output());
  this.cli = cli;
  this.ansi = false; // cli.getReader().getTerminal().isAnsiSupported();
  if (args.length == 1) {
    usage(cli);
    return;
  }
  for (int i = 1; i < args.length; i++) {
    try {
      Logger logger = (Logger) NameRegistrar.get("logger." + args[i]);
      logger.addListener(this);
    } catch (NameRegistrar.NotFoundException e) {
      cli.println("Logger " + args[i] + " not found -- ignored.");
    }
  }
  // cli.getReader().readCharacter(new char[]{'q', 'Q'});
  cli.getReader().readLine();
  for (int i = 1; i < args.length; i++) {
    try {
      Logger logger = (Logger) NameRegistrar.get("logger." + args[i]);
      logger.removeListener(this);
    } catch (NameRegistrar.NotFoundException ignored) {
      // NOPMD OK to happen
    }
  }
}
origin: jpos/jPOS

public void exec(CLIContext cli, String[] args) throws Exception {
  this.p = new PrintStream(cli.getReader().getTerminal().output());
  this.cli = cli;
  this.ansi = false; // cli.getReader().getTerminal()
  cli.getReader().readLine();
origin: jpos/jPOS-EE

Terminal term= cli.getReader().getTerminal();
origin: jpos/jPOS

  ((CLICommand) cmd).exec(ctx, args);
} else if (cmd instanceof Command) {
  Terminal t = ctx.getReader().getTerminal();
  ((Command) cmd).exec (t.input(), t.output(), t.output(), args);
org.jpos.q2CLIContextgetReader

Popular methods of CLIContext

  • println
  • getOutputStream
  • getCLI
  • getUserData
  • print
  • <init>
  • builder
  • confirm
  • isInteractive
  • isStopped
  • printLoggeable
  • printThrowable
  • printLoggeable,
  • printThrowable,
  • setReader,
  • setStopped

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now