Java 8 PrintStream - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 PrintStream class.

This code example shows how to use the following methods: flush, println
        final PrintStream out = new TelnetPrintStream(sockOut);
 
        assertEmptyLine(in);
        assertEquals("type 'help' for a list of commands", in.readLine());
 
        out.println("set a b");
        out.flush();
        assertReply("set a to b", in.readLine());
        assertEmptyLine(in);
 
        out.println("get a");
        out.flush();
        assertReply("b", in.readLine());
        assertEmptyLine(in);
 
        out.println("list");
        out.flush();
        assertReply("a = b", in.readLine());
        assertEmptyLine(in);
    } 

9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: print
  private void printBeginEnvelope(String tag) {
    if (!compoundStack.empty()) {
      String s = compoundStack.peek();
      if ("struct".equals(s)) {
        putIndent(); 
        stream.print("<member>\n");
        addIndent(); 
        putIndent(); 
        stream.print("<name>"+tag+"</name>\n");
        putIndent(); 
        stream.print("<value>");
      } else if ("vector".equals(s)) {
        stream.print("<value>");
      } else if ("map".equals(s)) {
        stream.print("<value>");
      } 
    } else { 
      stream.print("<value>");
    } 
  } 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
  public ProfileOutput(PrintStream out) {
    this.stream = out;
  } 
 
  public ProfileOutput(File out) throws FileNotFoundException {
    this.stream = new PrintStream(new FileOutputStream(out));
  } 
 
  public void printProfile(ProfilePrinter printer) {
    if (headerPrinted) {
      printer.printProfile(stream, false);
    } else { 
      printer.printHeader(stream);
      printer.printProfile(stream, true);
      headerPrinted = true;
      footerAndCleanupOnShutdown(printer);
    } 
  } 
 
  private void footerAndCleanupOnShutdown(final ProfilePrinter printer) {
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    private StandardErrorLogger logger;
    private PrintStream stream;
 
    public void setUp() { 
        baos = new ByteArrayOutputStream();
        stream = new PrintStream(baos);
        logger = new StandardErrorLogger("test", stream);
    } 
 
    public void tearDown() throws IOException { 
        baos.reset();
        baos.close();
    } 
 
    public void testWithDebuggingDisabled() { 
        logger.setDebugEnable(false);
        logger.debug("test");
        stream.flush();
        Assert.assertEquals("", baos.toString());
    } 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: printf, println
  public static int run(Tool tool, String[] args) throws Exception {
    return run(tool.getConf(), tool, args);
  } 
 
  public static void printMrsstableCommandUsage(PrintStream out) {
    out.printf("Usage: %s [options] <input dirs> <output dir>\n", MrsstableRunner.class.getSimpleName());
    out.println("options supported are (overload the param of configuration file, which is specified with -conf) : ");
    out.println("-table_id <table id>           overload mrsstable.table.id");
    out.println("-rowkey_desc <rowkey desc>     overload mrsstable.rowkey.desc");
    out.println("-sampler <sampler type>        overload mrsstable.presort.sampler");
    out.println("-delim <delim>                 overload mrsstable.primary.delimeter");
    out.println("-null_flag <null_flag>         overload mrsstable.primary.nullflag");
 
    GenericOptionsParser.printGenericCommandUsage(out);
  } 
 
  public static void main(String[] args) throws Exception {
    int res = MrsstableRunner.run(new Configuration(), new MRGenSstable(), args);
    System.exit(res);
  } 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: checkError, print
 
  private PrintStream stream;
  private boolean isFirst = true;
     
  private void throwExceptionOnError(String tag) throws IOException {
    if (stream.checkError()) {
      throw new IOException("Error serializing "+tag);
    } 
  } 
  
  private void printCommaUnlessFirst() { 
    if (!isFirst) {
      stream.print(",");
    } 
    isFirst = false;
  } 
     
  /** Creates a new instance of CsvRecordOutput */ 
  public CsvRecordOutput(OutputStream out) {
    try { 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: println
    ByteArrayOutputStream bStream = new ByteArrayOutputStream();
    PrintStream out = new PrintStream(bStream, true);
    int errCode = ToolRunner.run(new DFSck(conf, out),
        new String[]{"/", "-files"});
    String result = bStream.toString();
    System.out.println("output from fsck:\n" + result);
    assertEquals(0, errCode);
    assertTrue(result.contains("/test1"));
    assertTrue(result.contains("/test2"));
  } 
} 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: print
        instructions.add(MESSAGES.argVersion()); 
    } 
 
    public static void printUsage(final PrintStream out) {
        init(); 
        out.print(usage("appclient"));
    } 
} 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: close
   
  /** Output directory structure to a file, each line of the file 
   * contains the directory name. Only empty directory names are printed. */ 
  private void output(File outFile) throws FileNotFoundException {
    System.out.println("Printing to " + outFile.toString());
    PrintStream out = new PrintStream(outFile);
    root.output(out, null);
    out.close();
  } 
   
  /** Output all files' attributes to a file, each line of the output file 
   * contains a file name and its length. */ 
  private void outputFiles(File outFile) throws FileNotFoundException {
    System.out.println("Printing to " + outFile.toString());
    PrintStream out = new PrintStream(outFile);
    root.outputFiles(out, null);
    out.close();
  } 
   
  /** 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: print, println, PrintStream.print
        } 
        printDuration(out);
    } 
 
    private void printStepCounts(PrintStream out) {
        out.print(stepSubCounts.getTotal());
        out.print(" Steps (");
        printSubCounts(out, stepSubCounts);
        out.println(")");
    } 
 
    private void printScenarioCounts(PrintStream out) {
        out.print(scenarioSubCounts.getTotal());
        out.print(" Scenarios (");
        printSubCounts(out, scenarioSubCounts);
        out.println(")");
    } 
 
    private void printSubCounts(PrintStream out, SubCounts subCounts) {
        boolean addComma = false;

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 PrintStream Questions & Answers:

See Code Examples for Java 8 PrintStream Methods: