Package java.io

Examples of java.io.PrintStream


   * @throws IOException on io error
   */
  // process command line switches
  static public void main(String[] args) throws IOException, NoValidGribException {
    RandomAccessFile raf = null;
    PrintStream ps = System.out;
    String infile = args[0];
    raf = new RandomAccessFile(infile, "r");
    raf.order(RandomAccessFile.BIG_ENDIAN);
    // This is the GDS offset
    raf.skipBytes(Integer.parseInt(args[1]));
    // backup to PDS; most of the time it's only 28 bytes
    //raf.skipBytes( -28 ); //TODO: check
    Grib1ProductDefinitionSection pds = new Grib1ProductDefinitionSection(raf);
    Grib1Pds gpv = pds.pdsVars;
    ps.println("Length = " + gpv.getLength());
    ps.println("TimeRangeIndicator = " + gpv.getTimeRangeIndicator());

    assert (pds.length == gpv.getLength());
    assert (pds.table_version == gpv.getParameterTableVersion());
    assert (pds.center_id == gpv.getCenter());
    assert (pds.typeGenProcess == gpv.getGenProcessId());
View Full Code Here


     
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setVisible(true);
     
      PanelStream panelStream = new PanelStream(this.pane, 1024*1024);
      System.setErr(new PrintStream(panelStream));
      System.setOut(new PrintStream(panelStream));
      System.setIn(this.panelInputStream);
      this.pane.addKeyListener(this);
     
      loadAppl(args);
      System.out.println("END OF INIT");
View Full Code Here

    * @return The Stack trace as a String.
    */
   public static String getStackTraceAsString(Throwable ex) {
      // this is just to send the stack trace to the log file (stderr does not go there)
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      PrintStream pstr = new PrintStream(baos);
      if (ex == null)
         ex = new Exception();
      ex.printStackTrace(pstr);
      return new String(baos.toByteArray());
   }
View Full Code Here

    public void testMockConsoleOutputToConsole()
        throws Exception
    {
        final ByteArrayOutputStream arrayOutput = new ByteArrayOutputStream();
        final PrintStream output = new PrintStream( arrayOutput );
        final ConsoleLogger logger = new ConsoleLogger( MockConsoleLogger.LEVEL_ALL, output );
        logger.debug( "ignore me!", null );
        final String message = arrayOutput.toString();
        final String expectedMessage =
            "[DEBUG] ignore me!" + System.getProperty( "line.separator" );
View Full Code Here

   }

   public void testReadLine() {
      try {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         PrintStream ps = new PrintStream(baos);
         ps.println("first line");
         ps.println("");
         ps.println("");
         ps.println("");
         ps.println("second line");
         ps.println("third line");
         ps.println("");
         ps.println("");
         ps.close();
         byte[] buf = baos.toByteArray();
         byte[] buf1 = new byte[buf.length];
         for (int i=0; i < buf.length; i++) buf1[i] = buf[i];
        
         BufferedInputStreamMicro bism = new BufferedInputStreamMicro(new ByteArrayInputStream(buf));
View Full Code Here

   }

   public void testReadLineDelayed() {
      try {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         PrintStream ps = new PrintStream(baos);
         ps.println("first line");
         ps.println("");
         ps.println("");
         ps.println("");
         ps.println("second line");
         ps.println("third line");
         ps.println("");
         ps.println("");
         ps.close();
         byte[] buf = baos.toByteArray();
        
         int port1 = 26666;
         int port2 = 26667;
         Receiver receiver1 = new Receiver(port1, false);
View Full Code Here

      try {
        compareVariableData(org, copy, showCompare, justOne);

      } catch (IOException e) {
        ByteArrayOutputStream bos = new ByteArrayOutputStream(10000);
        e.printStackTrace(new PrintStream(bos));
        f.format("%s", bos.toString());
      }
    }

    // nested variables
View Full Code Here

  public String getDetailInfo() {
    ByteArrayOutputStream ff = new ByteArrayOutputStream(100 * 1000);
    try {
      NetcdfFile ncfile = new FakeNetcdfFile();
      H5header detailParser = new H5header(myRaf, ncfile, this);
      detailParser.read(new PrintStream(ff));
    } catch (IOException e) {
      e.printStackTrace();
    }
    return ff.toString();
  }
View Full Code Here

     * @return  The stack trace
     */
    protected String getStackTrace() {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        new IllegalArgumentException("").printStackTrace(
            new PrintStream(baos));
        return baos.toString();
    }
View Full Code Here

      oDbb = null;
      }
    } else {
      SessionHandler oSssnHndlr = new SessionHandler(oSessionProps);
    ByteArrayOutputStream oByteOutStrm = new ByteArrayOutputStream();
    PrintStream oPrntStrm = new PrintStream(oByteOutStrm);
    for (int r=0; r<nRecipients; r++) {
        oSssnHndlr.sendMessage(sSubject, sFromPersonal, sFromAddr, sReplyAddr,
                               new String[]{aRecipients[r]}, oRecType,
                               sTextPlain, sTextHtml, sEncoding,
                               sId, aAttachments, sUserDir, oPrntStrm);
      if (oByteOutStrm.size()>0) {
        aWarnings.add(aRecipients[r]+" "+oByteOutStrm.toString());
        oByteOutStrm.reset();
      }
    } // next
    oPrntStrm.close();
      oSssnHndlr.close();     
    }// fi (sJobTl)

    if (DebugFile.trace) {
      for (String w : aWarnings) {
View Full Code Here

TOP

Related Classes of java.io.PrintStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.