(a interface{})
| 124 | } |
| 125 | |
| 126 | func (wb *writeBuffer) write(a interface{}) { |
| 127 | switch v := a.(type) { |
| 128 | case int8: |
| 129 | wb.writeInt8(v) |
| 130 | case int16: |
| 131 | wb.writeInt16(v) |
| 132 | case int32: |
| 133 | wb.writeInt32(v) |
| 134 | case int64: |
| 135 | wb.writeInt64(v) |
| 136 | case string: |
| 137 | wb.writeString(v) |
| 138 | case []byte: |
| 139 | wb.writeBytes(v) |
| 140 | case bool: |
| 141 | wb.writeBool(v) |
| 142 | case writable: |
| 143 | v.writeTo(wb) |
| 144 | default: |
| 145 | panic(fmt.Sprintf("unsupported type: %T", a)) |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | func (wb *writeBuffer) Write(b []byte) (int, error) { |
| 150 | return wb.w.Write(b) |