On Wed, 18 Jan 2017, at 02:23 PM, Tomi Häsä wrote:

> What is the difference between XML Encoder and Marshal (or
> MarshalIndent)? They both are used when writing to a stream. When do
> you use Encoder?


Marshal doesn't write to a stream. It returns a byte slice which you
could then use directly or write to a stream later. It means the entire
serialization of the XML document must be held in memory whereas the
Encode method can use less memory by writing the serialization
incrementally to the io.Writer it is bound to.





-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to