diff options
| author | Carl C. Trieloff <cctrieloff@apache.org> | 2008-02-28 18:55:21 +0000 |
|---|---|---|
| committer | Carl C. Trieloff <cctrieloff@apache.org> | 2008-02-28 18:55:21 +0000 |
| commit | ac3f850123c903f00c163d6d2dbad22d98aec7a2 (patch) | |
| tree | 2e622a3e9349a9062454d16bf4bca83a5a3e9d90 /python/qpid/codec.py | |
| parent | 1820dd421a096ed184a08deee9512e809312fed2 (diff) | |
| download | qpid-python-ac3f850123c903f00c163d6d2dbad22d98aec7a2.tar.gz | |
QPID-820 from tross
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@632087 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/codec.py')
| -rw-r--r-- | python/qpid/codec.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/python/qpid/codec.py b/python/qpid/codec.py index b25de11f11..1a9372455d 100644 --- a/python/qpid/codec.py +++ b/python/qpid/codec.py @@ -265,6 +265,38 @@ class Codec: """ return self.unpack("!Q") + def encode_float(self, o): + self.pack("!f", o) + + def decode_float(self): + return self.unpack("!f") + + def encode_double(self, o): + self.pack("!d", o) + + def decode_double(self): + return self.unpack("!d") + + def encode_bin128(self, b): + for idx in range (0,16): + self.pack("!B", ord (b[idx])) + + def decode_bin128(self): + result = "" + for idx in range (0,16): + result = result + chr (self.unpack("!B")) + return result + + def encode_raw(self, len, b): + for idx in range (0,len): + self.pack("!B", b[idx]) + + def decode_raw(self, len): + result = "" + for idx in range (0,len): + result = result + chr (self.unpack("!B")) + return result + def enc_str(self, fmt, s): """ encodes a string 's' in network byte order as per format 'fmt' |
