Example #1
0
 def encode_to_stream(self, value, out_stream: OutputStream):
     user_context = decimal.getcontext()
     decimal.setcontext(self.context)
     value = value.quantize(self.scale_format)
     bytes_value = str(value).encode("utf-8")
     out_stream.write_bytes(bytes_value, len(bytes_value))
     decimal.setcontext(user_context)
Example #2
0
 def encode_to_stream(self, value, out_stream: OutputStream):
     bytes_value = str(value).encode("utf-8")
     out_stream.write_bytes(bytes_value, len(bytes_value))
Example #3
0
 def encode_to_stream(self, value, out_stream: OutputStream):
     out_stream.write_bytes(value, len(value))