2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2020

03/02/2003: How Can I Improve the I/O Speed for System.out.println Using Java?

Normally, the System.out print stream has a buffer size of 128 and flushes the buffer whenever a newline character is encountered.

The following four lines of java change the buffer size to 1024 and doesn’t flush the buffer for newline characters.

FileOutputStream fdout = new FileOutputStream(FileDescriptor.out);
BufferedOutputStream bos = new BufferedOutputStream(fdout, 1024);
PrintStream ps = new PrintStream(bos, false);
System.setOut(ps);

03/01/2003: How to Find the Parent Frame of a Component Using Java

How to Find the Parent Frame of a Component Using Java

Frame getParentFrame() {
  Component p = this;

  while ( (p = p.getParent()) != null && !(p instanceof Frame) )
    ;
  return( (Frame)p );
}