Go Package bytes: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
<pre>
<pre>
var buffer bytes.Buffer
var buffer bytes.Buffer
bytes := buffer.Bytes[]
bytes := buffer.Bytes()
</pre>
</pre>

Revision as of 22:17, 30 March 2016

External

Internal

Buffer

A Buffer does not have to be initialized and supports both Reader and Writer interface.

Conversion of a Buffer into a []byte:

var buffer bytes.Buffer
bytes := buffer.Bytes()