Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
BinHex Class Reference

Public Member Functions

def __init__
 
def write
 
def close_data
 
def write_rsrc
 
def close
 

Data Fields

 ofp
 
 crc
 
 dlen
 
 rlen
 
 state
 

Detailed Description

Definition at line 180 of file binhex.py.

Constructor & Destructor Documentation

def __init__ (   self,
  name,
  finfo,
  dlen,
  rlen,
  ofp 
)

Definition at line 181 of file binhex.py.

References aifc.open().

182  def __init__(self, (name, finfo, dlen, rlen), ofp):
183  if type(ofp) == type(''):
184  ofname = ofp
185  ofp = open(ofname, 'w')
186  if os.name == 'mac':
187  fss = macfs.FSSpec(ofname)
188  fss.SetCreatorType('BnHq', 'TEXT')
189  ofp.write('(This file must be converted with BinHex 4.0)\n\n:')
190  hqxer = _Hqxcoderengine(ofp)
191  self.ofp = _Rlecoderengine(hqxer)
192  self.crc = 0
193  if finfo is None:
194  finfo = FInfo()
195  self.dlen = dlen
196  self.rlen = rlen
197  self._writeinfo(name, finfo)
198  self.state = _DID_HEADER

Member Function Documentation

def close (   self)

Definition at line 244 of file binhex.py.

References BinHex._writecrc(), BinHex.close_data(), _Hqxcoderengine.ofp, _Rlecoderengine.ofp, BinHex.ofp, BinHex.rlen, and BinHex.state.

245  def close(self):
246  if self.state < _DID_DATA:
247  self.close_data()
248  if self.state != _DID_DATA:
249  raise Error, 'Close at the wrong time'
250  if self.rlen != 0:
251  raise Error, \
252  "Incorrect resource-datasize, diff="+`self.rlen`
253  self._writecrc()
254  self.ofp.close()
255  self.state = None
256  del self.ofp
def close_data (   self)

Definition at line 230 of file binhex.py.

References BinHex._writecrc(), BinHex.dlen, BinHex.rlen, and BinHex.state.

231  def close_data(self):
232  if self.dlen != 0:
233  raise Error, 'Incorrect data size, diff='+`self.rlen`
234  self._writecrc()
235  self.state = _DID_DATA
def write (   self,
  data 
)

Definition at line 224 of file binhex.py.

References BinHex._write(), BinHex.dlen, and BinHex.state.

225  def write(self, data):
226  if self.state != _DID_HEADER:
227  raise Error, 'Writing data at the wrong time'
228  self.dlen = self.dlen - len(data)
229  self._write(data)
def write_rsrc (   self,
  data 
)

Definition at line 236 of file binhex.py.

References BinHex._write(), BinHex.close_data(), BinHex.rlen, and BinHex.state.

237  def write_rsrc(self, data):
238  if self.state < _DID_DATA:
239  self.close_data()
240  if self.state != _DID_DATA:
241  raise Error, 'Writing resource data at the wrong time'
242  self.rlen = self.rlen - len(data)
243  self._write(data)

Field Documentation

crc

Definition at line 191 of file binhex.py.

dlen

Definition at line 194 of file binhex.py.

ofp

Definition at line 190 of file binhex.py.

rlen

Definition at line 195 of file binhex.py.

state

Definition at line 197 of file binhex.py.


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