Go Package bytes: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 12: Line 12:


A <tt>Buffer</tt> does not have to be initialized and supports both <tt>[[Go_Package_io#Reader|Reader]]</tt> and <tt>[[Go_Package_io#Writer|Writer]]</tt> interface.
A <tt>Buffer</tt> does not have to be initialized and supports both <tt>[[Go_Package_io#Reader|Reader]]</tt> and <tt>[[Go_Package_io#Writer|Writer]]</tt> interface.
Conversion of a <tt>Buffer</tt> into a <tt>[]byte</tt>:
<pre>
var buffer bytes.Buffer
bytes := buffer.Bytes[]
</pre>

Revision as of 22:16, 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[]