utility.go (414B)
1 package iptc 2 3 import ( 4 "bytes" 5 "fmt" 6 7 "github.com/dsoprea/go-logging" 8 ) 9 10 // DumpBytesToString returns a stringified list of hex-encoded bytes. 11 func DumpBytesToString(data []byte) string { 12 b := new(bytes.Buffer) 13 14 for i, x := range data { 15 _, err := b.WriteString(fmt.Sprintf("%02x", x)) 16 log.PanicIf(err) 17 18 if i < len(data)-1 { 19 _, err := b.WriteRune(' ') 20 log.PanicIf(err) 21 } 22 } 23 24 return b.String() 25 }