2013-10-30 01:11:04 +00:00
|
|
|
// 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"
|
|
|
|
)
|
|
|
|
|
2014-01-29 00:37:15 +00:00
|
|
|
var (
|
|
|
|
newline = []byte{'\n'}
|
|
|
|
dataindent = []byte{'\t', '\t'}
|
|
|
|
space = []byte{' '}
|
|
|
|
)
|
2013-10-30 01:11:04 +00:00
|
|
|
|
|
|
|
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)
|
2014-01-29 00:37:15 +00:00
|
|
|
w.Writer.Write(dataindent)
|
2013-10-30 01:11:04 +00:00
|
|
|
w.c = 0
|
2014-01-29 00:37:15 +00:00
|
|
|
} else {
|
|
|
|
w.Writer.Write(space)
|
2013-10-30 01:11:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Fprintf(w.Writer, "0x%02x,", p[n])
|
|
|
|
w.c++
|
|
|
|
}
|
|
|
|
|
|
|
|
n++
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|