-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite.go
82 lines (63 loc) · 1.21 KB
/
write.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
74
75
76
77
78
79
80
81
82
package magic
import (
"fmt"
"os"
)
func (m *Manager) writeBytes(buf []byte) {
_, err := m.out.Write(buf)
if err != nil {
fmt.Printf("[manager] unable to write to output: %v\n", err)
os.Exit(-1)
}
}
func (m *Manager) Write(v interface{}) {
m.WriteString(fmt.Sprintf("%v", v))
}
func (m *Manager) Writef(format string, a ...interface{}) {
m.WriteString(fmt.Sprintf(format, a...))
}
func (m *Manager) WriteBool(v bool) {
m.Write(v)
}
func (m *Manager) WriteInt8(v int8) {
m.Write(v)
}
func (m *Manager) WriteInt16(v int16) {
m.Write(v)
}
func (m *Manager) WriteInt32(v int32) {
m.Write(v)
}
func (m *Manager) WriteInt64(v int64) {
m.Write(v)
}
func (m *Manager) WriteInt(v int) {
m.Write(v)
}
func (m *Manager) WriteByte(v byte) {
m.Write(v)
}
func (m *Manager) WriteUint8(v uint8) {
m.Write(v)
}
func (m *Manager) WriteUint16(v uint16) {
m.Write(v)
}
func (m *Manager) WriteUint32(v uint32) {
m.Write(v)
}
func (m *Manager) WriteUint64(v uint64) {
m.Write(v)
}
func (m *Manager) WriteUint(v uint) {
m.Write(v)
}
func (m *Manager) WriteFloat32(v float32) {
m.Write(v)
}
func (m *Manager) WriteFloat64(v float64) {
m.Write(v)
}
func (m *Manager) WriteString(s string) {
m.writeBytes([]byte(s))
}