-
Notifications
You must be signed in to change notification settings - Fork 0
/
len.go
73 lines (69 loc) · 2.14 KB
/
len.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package iox
import (
"io"
)
func Len(reader io.Reader) (uint64, bool) {
switch lener := reader.(type) {
case interface{ Len() int }:
return uint64(lener.Len()), true
case interface{ Len() uint }:
return uint64(lener.Len()), true
case interface{ Len() int64 }:
return uint64(lener.Len()), true
case interface{ Len() uint64 }:
return lener.Len(), true
case interface{ Len() int32 }:
return uint64(lener.Len()), true
case interface{ Len() uint32 }:
return uint64(lener.Len()), true
case interface{ Len() int16 }:
return uint64(lener.Len()), true
case interface{ Len() uint16 }:
return uint64(lener.Len()), true
case interface{ Len() int8 }:
return uint64(lener.Len()), true
case interface{ Len() uint8 }:
return uint64(lener.Len()), true
case interface{ Length() int }:
return uint64(lener.Length()), true
case interface{ Length() uint }:
return uint64(lener.Length()), true
case interface{ Length() int64 }:
return uint64(lener.Length()), true
case interface{ Length() uint64 }:
return lener.Length(), true
case interface{ Length() int32 }:
return uint64(lener.Length()), true
case interface{ Length() uint32 }:
return uint64(lener.Length()), true
case interface{ Length() int16 }:
return uint64(lener.Length()), true
case interface{ Length() uint16 }:
return uint64(lener.Length()), true
case interface{ Length() int8 }:
return uint64(lener.Length()), true
case interface{ Length() uint8 }:
return uint64(lener.Length()), true
case interface{ Size() int }:
return uint64(lener.Size()), true
case interface{ Size() uint }:
return uint64(lener.Size()), true
case interface{ Size() int64 }:
return uint64(lener.Size()), true
case interface{ Size() uint64 }:
return lener.Size(), true
case interface{ Size() int32 }:
return uint64(lener.Size()), true
case interface{ Size() uint32 }:
return uint64(lener.Size()), true
case interface{ Size() int16 }:
return uint64(lener.Size()), true
case interface{ Size() uint16 }:
return uint64(lener.Size()), true
case interface{ Size() int8 }:
return uint64(lener.Size()), true
case interface{ Size() uint8 }:
return uint64(lener.Size()), true
}
return 0, false
}