parameters: (self)
return_statement: return self._buf
docstring: Finishes encoding process and returns underlying buffer.
docstring_summary: Finishes encoding process and returns underlying buffer.
docstring_tokens: Finishes encoding process and returns underlying buffer .
function: def Finish(self):
      """Finishes encoding process and returns underlying buffer."""
      if self._finished:
        raise RuntimeError('builder has been already finished')
  
      # If you hit this exception, you likely have objects that were never
      # included in a parent. You need to have exactly one root to finish a
      # buffer. Check your Start/End calls are matched, and all objects are inside
      # some other object.
      if len(self._stack) != 1:
        raise RuntimeError('internal stack size must be one')
  
      value = self._stack[0]
      byte_width = self._Align(value.ElemWidth(len(self._buf)))
      self._WriteAny(value, byte_width=byte_width)  # Root value
      self._Write(U, value.StoredPackedType(), byte_width=1)  # Root type
      self._Write(U, byte_width, byte_width=1)  # Root size
  
      self.finished = True
      return self._buf
function_tokens: def Finish ( self ) : if self . _finished : raise RuntimeError ( 'builder has been already finished' ) # If you hit this exception, you likely have objects that were never # included in a parent. You need to have exactly one root to finish a # buffer. Check your Start/End calls are matched, and all objects are inside # some other object. if len ( self . _stack ) != 1 : raise RuntimeError ( 'internal stack size must be one' ) value = self . _stack [ 0 ] byte_width = self . _Align ( value . ElemWidth ( len ( self . _buf ) ) ) self . _WriteAny ( value , byte_width = byte_width ) # Root value self . _Write ( U , value . StoredPackedType ( ) , byte_width = 1 ) # Root type self . _Write ( U , byte_width , byte_width = 1 ) # Root size self . finished = True return self . _buf