Codota Logo
CLIContext.getReader
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
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

  • Reading from database using SQL prepared statement
  • runOnUiThread (Activity)
  • findViewById (Activity)
  • startActivity (Activity)
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now