Exemplo n.º 1
0
func (i *index) Bytes() []byte {
	b := make([]byte, headerSize)
	w := bytes.NewWriter(b[4:])
	binary.Write(w, binary.LittleEndian, i)
	binary.LittleEndian.PutUint32(b, crc32.ChecksumIEEE(b[4:]))
	return b
}
Exemplo n.º 2
0
func Qiniu() {
	data["Content"] = "Qiniu"
	buf := make([]byte, 100, 100)
	r := qby.NewReader(buf)
	w := qby.NewWriter(buf)
	err := tpl.Execute(w, data)
	fmt.Println("error:", err)
	bs := r.Bytes()
	fmt.Println("reader bytes:", string(bs), "|")
	fmt.Println("origin bytes:", string(buf), "|")
	data["Content"] = "Ya"
	w.Reset()
	tpl.Execute(w, data)
	fmt.Println("reader2 bytes:", string(r.Bytes()), "|", string(w.Bytes()), "|")
}
Exemplo n.º 3
0
func init() {
	// rpcsv.UpdataTheme()

	buf = make([]byte, 8096)
	qiniuWriter = qiniubytes.NewWriter(buf)
}