mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-02 15:08:20 +00:00
Add Ref.AsStringBytes to flatbuffers.flexbuffers Python API (#7713)
* Add Ref.AsStringBytes to flatbuffers.flexbuffers Python API * Append Bytes to AsStringBytes return value Co-authored-by: Jared Junyoung Lim <jaredlim@google.com>
This commit is contained in:
committed by
GitHub
parent
e1a2f688e0
commit
40aa964057
@@ -727,6 +727,15 @@ class Ref:
|
|||||||
def IsString(self):
|
def IsString(self):
|
||||||
return self._type is Type.STRING
|
return self._type is Type.STRING
|
||||||
|
|
||||||
|
@property
|
||||||
|
def AsStringBytes(self):
|
||||||
|
if self.IsString:
|
||||||
|
return String(self._Indirect(), self._byte_width).Bytes
|
||||||
|
elif self.IsKey:
|
||||||
|
return self.AsKeyBytes
|
||||||
|
else:
|
||||||
|
raise self._ConvertError(Type.STRING)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def AsString(self):
|
def AsString(self):
|
||||||
if self.IsString:
|
if self.IsString:
|
||||||
|
|||||||
Reference in New Issue
Block a user