1. PrintWriter's print and println methods can accept parameters of any type, while the write method of BufferedWriter can only accept characters, array of characters, and strings;
2. PrintWriter's Println method automatically adds line wrapping, BufferedWriter needs to display the calling newline method;
3. The PrintWriter method does not throw the exception, if concerns the exception, needs to call the CheckError method to see whether has the unusual occurrence;
4. PrintWriter construction method can specify parameters, realize automatic refresh cache (AutoFlush);
5. The PrintWriter method is more widely constructed.
-------------------------------------------------------------------
PrintWriter and BufferedWriter are inherited java.io.Writer, so many functions are the same. However, PrintWriter provides a println () method to write line breaks for different platforms, and BufferedWriter can set any buffer size.
OutputStream can be passed directly to PrintWriter (BufferedWriter cannot receive), such as:
PrintWriter out
= new PrintWriter (new Bufferedoutputstream) (New FileOutputStream ("Foo.out"));
or use OutputStreamWriter to convert OutputStream to Wrtier. Then you can use the BufferedWriter. The
API documents are well written.