Code example for PrintStream

Methods: close

0
	private static String toStackTraceString(Throwable t) {
		if (t == null) {
			return ""; 
		} 
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		PrintStream ps = new PrintStream(baos);
 
		t.printStackTrace(ps);
		ps.close();
		return baos.toString();
	} 
 
	public static void printlnToRobotsConsole(String s) {
		// this will get redirected to robot's console 
		System.out.println(s);
	} 
}