Code example for PrintStream

Methods: print, println

0
     * Constructor that prints the message of the exception on the given stream 
     */ 
    @SuppressWarnings("nls") 
    public NotImplementedException(PrintStream stream) {
        super(); 
        stream.println("*** NOT IMPLEMENTED EXCEPTION ***");
        StackTraceElement thrower = getStackTrace()[0];
        stream.println("*** thrown from class  -> " + thrower.getClassName());
        stream.println("***             method -> " + thrower.getMethodName());
 
        stream.print("*** defined in         -> ");
        if (thrower.isNativeMethod()) {
            stream.println("a native method");
        } else { 
            String fileName = thrower.getFileName();
            if (fileName == null) {
                stream.println("an unknown source");
            } else { 
                int lineNumber = thrower.getLineNumber();
                stream.print("the file \"" + fileName + "\"");
                if (lineNumber >= 0) {
                    stream.print(" on line #" + lineNumber);
                } 
                stream.println();
            } 
        } 
    } 
 
    /**