List of usage examples for java.lang System in
InputStream in
To view the source code for java.lang System in.
Click Source Link
From source file:ee.ria.xroad.common.conf.globalconfextension.OcspFetchIntervalStdinValidator.java
/** * Program entry point/*from ww w. ja v a 2s . c o m*/ */ public static void main(String[] args) throws Exception { String string = IOUtils.toString(System.in, StandardCharsets.UTF_8.toString()); System.out.println(string); OcspFetchIntervalSchemaValidator.validate(string); }
From source file:ee.ria.xroad.proxy.serverproxy.StdinValidator.java
/** * Program entry point// w w w.j a v a 2 s . c om */ public static void main(String[] args) throws Exception { String string = IOUtils.toString(System.in, StandardCharsets.UTF_8.toString()); System.out.println(string); MonitoringParametersSchemaValidator.validate(string); }
From source file:org.dcache.xdr.SpringRunner.java
public static void main(String[] args) throws IOException { if (args.length != 1) { System.err.println("Usage: SpringRunner <config>"); System.exit(1);/* w w w .j av a2s . co m*/ } try { ApplicationContext context = new FileSystemXmlApplicationContext(args[0]); OncRpcSvc service = (OncRpcSvc) context.getBean("oncrpcsvc"); service.start(); System.in.read(); } catch (BeansException e) { System.err.println("Spring: " + e.getMessage()); System.exit(1); } }
From source file:com.yumfee.extremeworld.QuickStartServer.java
public static void main(String[] args) throws Exception { // Springprofile Profiles.setProfileAsSystemProperty(Profiles.DEVELOPMENT); System.out.println(DateUtils.getTodayBeginDate().toString()); // ?Jetty/* w ww. ja va 2 s .c om*/ Server server = JettyFactory.createServerInSource(PORT, CONTEXT); JettyFactory.setTldJarNames(server, TLD_JAR_NAMES); try { server.start(); System.out.println("[INFO] Server running at http://localhost:" + PORT + CONTEXT); System.out.println("[HINT] Hit Enter to reload the application quickly"); // ?. while (true) { char c = (char) System.in.read(); if (c == '\n') { JettyFactory.reloadContext(server); } } } catch (Exception e) { e.printStackTrace(); System.exit(-1); } }
From source file:GGbot.pkg0.Mainclass.java
public static void main(String[] args) throws InterruptedException, TwitterException, DbxException, IOException, Exception { String input = ""; System.out.println("Welcomet to GGbot\nFor more information please take a look at the Read Me\n"); System.out.println("- Twitter: PlayerName (flex, returns the latest tweets from a player)\n" + "- Facebook: PlayerName (flex, returns all the information available about a player)\n" + "- Note to self: Input (notflex, create a new text document with your input, and put it in a drop box)\n" + "- Translate: Input (notflex, detects the language of your input and translate it to english)\n" + "- Wiki (flex, returns the definition of league of legends from wikipedia\n" + "- !Players: (returns the list of the players available in the library (only players from the teams: Cloud9, CLG, and TSM are available at the moment))\n" + "- !dropbox: (returns the link to the dropbox)\n\n" + "Start to chat now!\n"); while (!input.contains("bye")) { System.out.print("<User>"); Scanner scanner = new Scanner(System.in); input = scanner.nextLine();/*w w w . jav a 2s .c om*/ String output = bot.Bot(input.toLowerCase().trim()); System.out.println("<GGbot>" + WordUtils.wrap(output, 75)); } }
From source file:com.lightboxtechnologies.spectrum.Uploader.java
public static void main(String[] args) throws Exception { final Configuration conf = new Configuration(); final String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); if (otherArgs.length != 1) { System.err.println("Usage: Uploader <dest path>"); System.err.println("Writes data to HDFS path from stdin"); System.exit(2);//from ww w. j a v a2s .c o m } MessageDigest hasher = FsEntryUtils.getHashInstance("MD5"); DigestInputStream hashedIn = new DigestInputStream(System.in, hasher); FileSystem fs = FileSystem.get(conf); Path path = new Path(otherArgs[0]); FSDataOutputStream outFile = fs.create(path, true); IOUtils.copyLarge(hashedIn, outFile, new byte[1024 * 1024]); System.out.println(new String(Hex.encodeHex(hasher.digest()))); }
From source file:com.alibaba.dubbo.examples.memcached.MemcachedConsumer.java
@SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { String config = MemcachedConsumer.class.getPackage().getName().replace('.', '/') + "/memcached-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start();/* w w w . ja v a 2 s . c o m*/ Map<String, Object> cache = (Map<String, Object>) context.getBean("cache"); cache.remove("hello"); Object value = cache.get("hello"); System.out.println(value); if (value != null) { throw new IllegalStateException(value + " != null"); } cache.put("hello", "world"); value = cache.get("hello"); System.out.println(value); if (!"world".equals(value)) { throw new IllegalStateException(value + " != world"); } System.in.read(); }
From source file:com.linkedin.pinot.broker.broker.BrokerServerBuilderTest.java
public static void main(String[] args) throws Exception { PropertiesConfiguration config = new PropertiesConfiguration( new File(BrokerServerBuilderTest.class.getClassLoader().getResource("broker.properties").toURI())); final BrokerServerBuilder bld = new BrokerServerBuilder(config, null, null, null); bld.buildNetwork();/*from w ww. j a va2 s .co m*/ bld.buildHTTP(); bld.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { bld.stop(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { String command = br.readLine(); if (command.equals("exit")) { bld.stop(); } } }
From source file:net.officefloor.tutorial.javascriptapp.JavaScriptAppTest.java
/** * Allow running as application to manually test the JavaScript. *//* w ww .ja v a 2s . co m*/ public static void main(String[] arguments) throws Exception { WoofOfficeFloorSource.start(); System.out.println("Press [enter] to exit"); new BufferedReader(new InputStreamReader(System.in)).readLine(); WoofOfficeFloorSource.stop(); }
From source file:com.git.ifly6.components.Census.java
public static void main(String[] args) { Scanner scan = new Scanner(System.in); try {//from w ww.j av a 2 s .co m region = new NSRegion(args[0]); } catch (ArrayIndexOutOfBoundsException e) { System.out.print("Please input the name of your region: \t"); region = new NSRegion(scan.nextLine()); } try { HashMap<String, Integer> endoMap = new HashMap<String, Integer>(); String[] waMembers = region.getWAMembers(); int[] valueCount = new int[waMembers.length]; System.out.println( "[INFO] This census will take: " + time((int) Math.round(waitTime * waMembers.length))); for (int i = 0; i < waMembers.length; i++) { NSNation nation = new NSNation(waMembers[i]); valueCount[i] = nation.getEndoCount(); endoMap.put(waMembers[i], new Integer(valueCount[i])); System.out.println("[LOG] Fetched information for: " + waMembers[i] + ", " + (i + 1) + " of " + waMembers.length); } TreeMap<String, Integer> sortedMap = sortByValue(endoMap); int current = 0; int previous = sortedMap.firstEntry().getValue(); System.out.printf("%-35s %12s %12s%n", "Nations", "Endorsements", "Difference"); System.out.println("-------------------------------------------------------------"); for (Map.Entry<String, Integer> entry : sortedMap.entrySet()) { String nationName = StringUtils.capitalize(entry.getKey().replace('_', ' ')); current = entry.getValue(); if ((previous - current) != 0) { System.out.printf("%-35s %12s %12s%n", nationName, entry.getValue(), (previous - current)); } else { System.out.printf("%-35s %12s %12s%n", nationName, entry.getValue(), "-"); } previous = entry.getValue(); } System.out.println("-------------------------------------------------------------"); System.out.printf("%-35s %12s %12s%n", "Delegate", "Endorsements", "Proportion"); System.out.printf("%-35s %12s %12s%n", StringUtils.capitalize(sortedMap.firstEntry().getKey().replace('_', ' ')), sortedMap.firstEntry().getValue(), (double) (sortedMap.firstEntry().getValue() / waMembers.length)); } catch (IOException e) { printError("Failed to fetch WA members or get endorsements in this region. " + "Check your internet connection or the state of the API."); } scan.close(); }