MCPcopy Create free account
hub / github.com/apache/fory / BytesBufferObject

Class BytesBufferObject

python/pyfory/serializer.py:967–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

965
966
967class BytesBufferObject(BufferObject):
968 __slots__ = ("binary",)
969
970 def __init__(self, binary: bytes):
971 self.binary = binary
972
973 def total_bytes(self) -> int:
974 return len(self.binary)
975
976 def write_to(self, stream):
977 if hasattr(stream, "write_bytes"):
978 stream.write_bytes(self.binary)
979 else:
980 stream.write(self.binary)
981
982 def getbuffer(self) -> memoryview:
983 return memoryview(self.binary)
984
985
986class PickleBufferSerializer(Serializer):

Callers 1

writeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected