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

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • getSystemService (Context)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Option (scala)
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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