StringWriter is a Writer, it is nothing like StringBuffer and the purpose of each is so far from the other that it would be easier to explain the similarities which would be relegated to similarities that exist between all Objects. You should use a StringWriter when you want a Writer. You should use a StringBuffer when you need a mutable buffer for constructing Strings, or must construct a String in such a way that it cannot be done using String's constructors. In 1.5 you should use a StringBuilder instead.
The differences are superficial. You will find many such duplications throughout the J2SE API Specification. - An java.io.InputStream is just a java.util.Iterator<Byte> - An array is just a broken attempt at the (still broken but less so) java.util.List. - etc. etc.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
subject: wat diff between stringbuffer & stringwriter