コード例 #1
0
 def __iter__(self):
     if self.state == ReadStatus.eInit:
         raise ValueError('VSBReader has not been initialized')
     elif self.state == ReadStatus.eEndOfFile:
         self.__fileOpen(self.filename)
         if self.state != ReadStatus.eFileOpened:
             raise ValueError('VSB file has not been opened')
     elif self.state == ReadStatus.eError:
         vsb.ReadClose(self.handle)
         self.__fileOpen(self.filename)
         if self.state != ReadStatus.eFileOpened:
             raise ValueError('VSB file has not been opened')
     return self
コード例 #2
0
	def __next__(self):
		"""  get next message from the buffer.  """
		self.state, size = vsb.ReadNextMessage(self.handle, self.message, self.size)
		if self.state == vsb.eSuccess:
			return VSBMessage(self.message, vsb.GetEDP(self.message), size)
		elif self.state == vsb.eEndOfFile:
			vsb.ReadClose(self.handle)
			raise StopIteration()
		elif self.state == vsb.eError:
			raise ValueError(self.get_error_message())
		elif self.state == vsb.eBufferToSmall:
			vsb.VSBIOFree(self.message)
			self.message = vsb.VSBIOMalloc(size)
			self.size = size
			return self.__next__()
コード例 #3
0
 def __del__(self):
     vsb.VSBIOFree(self.message)
     if self.state != vsb.eEndOfFile:
         vsb.ReadClose(self.handle)