This commit is contained in:
Jae Kwon
2014-06-16 16:39:25 -07:00
parent f4d156a4b5
commit f61fdb5845
4 changed files with 86 additions and 41 deletions

View File

@ -18,6 +18,8 @@ const (
TYPE_STRING = Byte(0x10)
TYPE_BYTESLICE = Byte(0x11)
TYPE_TIME = Byte(0x20)
)
func GetBinaryType(o Binary) Byte {
@ -38,6 +40,8 @@ func GetBinaryType(o Binary) Byte {
case String: return TYPE_STRING
case ByteSlice: return TYPE_BYTESLICE
case Time: return TYPE_TIME
default: panic("Unsupported type")
}
}
@ -59,6 +63,8 @@ func ReadBinary(r io.Reader) Binary {
case TYPE_STRING: return ReadString(r)
case TYPE_BYTESLICE:return ReadByteSlice(r)
case TYPE_TIME: return ReadTime(r)
default: panic("Unsupported type")
}
}