当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 0

小小 / go-bindata
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
bytewriter.go 668 Bytes
一键复制 编辑 原始数据 按行查看 历史
Jim Teeuwen 提交于 2014-01-29 01:38 . Runs go fmt.
// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// license. Its contents can be found at:
// http://creativecommons.org/publicdomain/zero/1.0/
package bindata
import (
"fmt"
"io"
)
var (
newline = []byte{'\n'}
dataindent = []byte{'\t', '\t'}
space = []byte{' '}
)
type ByteWriter struct {
io.Writer
c int
}
func (w *ByteWriter) Write(p []byte) (n int, err error) {
if len(p) == 0 {
return
}
for n = range p {
if w.c%12 == 0 {
w.Writer.Write(newline)
w.Writer.Write(dataindent)
w.c = 0
} else {
w.Writer.Write(space)
}
fmt.Fprintf(w.Writer, "0x%02x,", p[n])
w.c++
}
n++
return
}
Go
1
https://gitee.com/haozibi/go-bindata.git
git@gitee.com:haozibi/go-bindata.git
haozibi
go-bindata
go-bindata
v3.0.7

搜索帮助

53164aa7 5694891 3bd8fe86 5694891