dcsimg
What is difference in flush of system.out or a buffered stream on top of it?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Namrata_Maheshwari
Posted On:   Wednesday, June 2, 2010 05:33 AM

public final class SystemUtil { private static PrintWriter OUT; public static PrintWriter out () { if (OUT == null) { try { OUT = new PrintWriter(bufferedWriter(System.out, System.getProperty("file.encoding"))); } catch (UnsupportedEncodingException ex) { //todo } } return OUT; } public static void flushOutput () { if (OUT != null) { OUT.flush(); } } } 1) If I use -> System.out.println("Message"); SystemUtil.flushOutput(); Will this flush System.out ? 2)How System.out.println is different from SystemUtil.out.printl   More>>

public final class SystemUtil {

private static PrintWriter OUT;
public static PrintWriter out ()
{
if (OUT == null) {
try {
OUT = new PrintWriter(bufferedWriter(System.out, System.getProperty("file.encoding")));
}
catch (UnsupportedEncodingException ex) {
//todo
}
}
return OUT;
}

public static void flushOutput ()
{
if (OUT != null) {
OUT.flush();
}
}

}



1) If I use -> System.out.println("Message");
SystemUtil.flushOutput();
Will this flush System.out ?


2)How System.out.println is different from SystemUtil.out.println

   <<Less
About | Sitemap | Contact