1
2
3
4
5
6
7 package exportdata
8
9 import (
10 "bufio"
11 "io"
12 "strconv"
13 "strings"
14 )
15
16
17 func readArchiveHeader(b *bufio.Reader, name string) int {
18
19 const HeaderSize = 60
20
21 var buf [HeaderSize]byte
22 if _, err := io.ReadFull(b, buf[:]); err != nil {
23 return -1
24 }
25 aname := strings.Trim(string(buf[0:16]), " ")
26 if !strings.HasPrefix(aname, name) {
27 return -1
28 }
29 asize := strings.Trim(string(buf[48:58]), " ")
30 i, _ := strconv.Atoi(asize)
31 return i
32 }
33
View as plain text