Examples using... "bytes"
Recent
RunParallel runs a benchmark in parallel.
It creates multiple goroutines and distributes b.N iterations among them.
The number of goroutines defaults to GOMAXPROCS. To increase parallelism for
non-CPU-bound benchmarks, call SetParallelism before RunParallel.
RunParallel is usually used with the go t...
A Pool is a set of temporary objects that may be individually saved and
retrieved.
StructOf returns the struct type containing fields.
The Offset and Index fields are ignored and computed as they would be
by the compiler.
Command returns the Cmd struct to execute the named program with
the given arguments.
DecodeHeader decodes all encoded-words of the given string. It returns an
error if and only if CharsetReader of d returns an error.
Decode decodes an RFC 2047 encoded-word.
Output writes the output for a logging event. The string s contains
the text to print after the prefix specified by the flags of the
Logger. A newline is appended if the last character of s is not
already a newline. Calldepth is used to recover the PC and is
provided for generality, although at the ...
A Logger represents an active logging object that generates lines of
output to an io.Writer. Each logging operation makes a single call to
the Writer's Write method. A Logger can be used simultaneously from
multiple goroutines; it guarantees to serialize access to the Writer.
TeeReader returns a Reader that writes to w what it reads from r.
All reads from r performed through it are matched with
corresponding writes to w. There is no internal buffering -
the write must complete before the read completes.
Any error encountered while writing is reported as a read error.
Pipe creates a synchronous in-memory pipe.
It can be used to connect code expecting an io.Reader
with code expecting an io.Writer.
MultiWriter creates a writer that duplicates its writes to all the
provided writers, similar to the Unix tee(1) command.
Package hash provides interfaces for hash functions.
ExampleInfo prints various facts recorded by the type checker in a
types.Info struct: definitions of and references to each named object,
and the type, value, and mode of every expression in the package.
Fprint "pretty-prints" an AST node to output.
It calls Config.Fprint with default settings.
Note that gofmt uses tabs for indentation but spaces for alignment;
use format.Node (package go/format) for output that matches gofmt.
Node formats node in canonical gofmt style and writes the result to dst.
Indent appends to dst an indented form of the JSON-encoded src.
Each element in a JSON object or array begins on a new,
indented line beginning with prefix followed by one or more
copies of indent according to the indentation nesting.
The data appended to dst does not begin with the prefix nor
any i...
HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029
characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029
so that the JSON will be safe to embed inside HTML <script> tags.
For historical reasons, web browsers don't honor standard HTML
escaping...
This example shows how to encode an interface value. The key
distinction from regular types is to register the concrete type that
implements the interface.
This example transmits a value that implements the custom encoding and decoding methods.
This example shows the basic usage of the package: Create an encoder,
transmit some values, receive them with a decoder.
Write writes the binary representation of data into w.
Data must be a fixed-size value or a slice of fixed-size
values, or a pointer to such data.
Boolean values encode as one byte: 1 for true, and 0 for false.
Bytes written to w are encoded using the specified byte order
and read from successive fi...
Write writes the binary representation of data into w.
Data must be a fixed-size value or a slice of fixed-size
values, or a pointer to such data.
Boolean values encode as one byte: 1 for true, and 0 for false.
Bytes written to w are encoded using the specified byte order
and read from successive fi...
Read reads structured binary data from r into data.
Data must be a pointer to a fixed-size value or a slice
of fixed-size values.
Bytes read from r are decoded using the specified byte order
and written to successive fields of the data.
When decoding boolean values, a zero byte is decoded as false, ...
Read reads structured binary data from r into data.
Data must be a pointer to a fixed-size value or a slice
of fixed-size values.
Bytes read from r are decoded using the specified byte order
and written to successive fields of the data.
When decoding boolean values, a zero byte is decoded as false, ...
This example reads 10 cryptographically secure pseudorandom numbers from
rand.Reader and writes them to a byte slice.
StreamWriter wraps a Stream into an io.Writer. It calls XORKeyStream
to process each slice of data which passes through. If any Write call
returns short then the StreamWriter is out of sync and must be discarded.
A StreamWriter has no internal buffering; Close does not need
to be called to flush wri...
StreamReader wraps a Stream into an io.Reader. It calls XORKeyStream
to process each slice of data which passes through.
NewWriter creates a new Writer.
Writes to the returned Writer are compressed and written to w.
NewReader creates a new ReadCloser.
Reads from the returned ReadCloser read and decompress data from r.
If r does not implement io.ByteReader, the decompressor may read more
data than necessary from r.
It is the caller's responsibility to call Close on the ReadCloser when done.
Package gzip implements reading and writing of gzip format compressed files,
as specified in RFC 1952.