Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
encoder.Encoder Class Reference

Public Member Functions

def __init__ (self)
 
def writeInt (self, value)
 
def writeBool (self, b)
 
def writeString (self, s)
 
def writeBinary (self, s)
 
def writeList (self, l)
 
def writeRaw (self, s)
 
def finish (self)
 
def getRaw (self)
 

Public Attributes

 data
 

Detailed Description

Definition at line 17 of file encoder.py.

Constructor & Destructor Documentation

◆ __init__()

def encoder.Encoder.__init__ (   self)

Definition at line 19 of file encoder.py.

19 def __init__(self):
20 self.data = []
21

Member Function Documentation

◆ finish()

def encoder.Encoder.finish (   self)

Definition at line 56 of file encoder.py.

56 def finish(self):
57 d = ''.join(self.data)
58 return _encVarInt(len(d)) + d
59
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ getRaw()

def encoder.Encoder.getRaw (   self)

Definition at line 60 of file encoder.py.

60 def getRaw(self):
61 return ''.join(self.data)

◆ writeBinary()

def encoder.Encoder.writeBinary (   self,
  s 
)
Encode binary data using base64.  This is less efficient than a 7-bit
encoding would be; however, it can be decoded much faster on most
browsers due to native support for the format.

Definition at line 40 of file encoder.py.

40 def writeBinary(self, s):
41 '''Encode binary data using base64. This is less efficient than a 7-bit
42 encoding would be; however, it can be decoded much faster on most
43 browsers due to native support for the format.'''
44 v = base64.b64encode(s)
45 self.writeInt(len(v))
46 self.data.append(v)
47
static void append(char **dst, size_t *count, const char *src, size_t n)
Definition: editor.cpp:211

◆ writeBool()

def encoder.Encoder.writeBool (   self,
  b 
)

Definition at line 32 of file encoder.py.

32 def writeBool(self, b):
33 self.data.append(('F', 'T')[b])
34

◆ writeInt()

def encoder.Encoder.writeInt (   self,
  value 
)
Uses a 7-bit per byte encoding to stay UTF-8 "safe".

Definition at line 22 of file encoder.py.

22 def writeInt(self, value):
23 '''Uses a 7-bit per byte encoding to stay UTF-8 "safe".'''
24 bits = value & 0x3f
25 value >>= 6
26 while value:
27 self.data.append(chr(0x40 | bits))
28 bits = value & 0x3f
29 value >>= 6
30 self.data.append(chr(bits))
31

◆ writeList()

def encoder.Encoder.writeList (   self,
  l 
)

Definition at line 48 of file encoder.py.

48 def writeList(self, l):
49 self.writeInt(len(l))
50 for i in l:
51 i.encode(self)
52

◆ writeRaw()

def encoder.Encoder.writeRaw (   self,
  s 
)

Definition at line 53 of file encoder.py.

53 def writeRaw(self, s):
54 self.data.append(s)
55

◆ writeString()

def encoder.Encoder.writeString (   self,
  s 
)

Definition at line 35 of file encoder.py.

35 def writeString(self, s):
36 if not s: s = ''
37 self.writeInt(len(s))
38 self.data.append(s)
39

Member Data Documentation

◆ data

encoder.Encoder.data

Definition at line 20 of file encoder.py.


The documentation for this class was generated from the following file: