add file link support
This commit is contained in:
20
bof.go
20
bof.go
@@ -1,12 +1,30 @@
|
||||
package xls
|
||||
|
||||
import ()
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"io"
|
||||
"unicode/utf16"
|
||||
)
|
||||
|
||||
type BOF struct {
|
||||
Id uint16
|
||||
Size uint16
|
||||
}
|
||||
|
||||
func (b *BOF) Reader(buf io.ReadSeeker) io.ReadSeeker {
|
||||
rts := make([]byte, b.Size)
|
||||
buf.Read(rts)
|
||||
return bytes.NewReader(rts)
|
||||
}
|
||||
|
||||
func (b *BOF) Utf16String(buf io.ReadSeeker, count uint32) string {
|
||||
var bts = make([]uint16, count)
|
||||
binary.Read(buf, binary.LittleEndian, &bts)
|
||||
runes := utf16.Decode(bts[:len(bts)-1])
|
||||
return string(runes)
|
||||
}
|
||||
|
||||
type BIFFHeader struct {
|
||||
Ver uint16
|
||||
Type uint16
|
||||
|
||||
Reference in New Issue
Block a user