本文整理汇总了Python中Block.Block.read方法的典型用法代码示例。如果您正苦于以下问题:Python Block.read方法的具体用法?Python Block.read怎么用?Python Block.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block.Block
的用法示例。
在下文中一共展示了Block.read方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def read(self):
Block.read(self)
if not self.valid:
return False
# name hash
self.hash_size = self._get_long(3)
self.hash_table = []
for i in xrange(self.hash_size):
self.hash_table.append(self._get_long(6+i))
# bitmap
self.bitmap_flag = self._get_long(-50)
self.bitmap_ptrs = []
for i in xrange(25):
bm_blk = self._get_long(-49+i)
self.bitmap_ptrs.append(bm_blk)
self.bitmap_ext_blk = self._get_long(-24)
# timestamps
self.mod_ts = self._get_timestamp(-23)
self.disk_ts = self._get_timestamp(-10)
self.create_ts = self._get_timestamp(-7)
# name
self.name = self._get_bstr(-20, 30)
self.extension = self._get_long(-2)
# check validity
self.valid = True
#self.valid = (self.bitmap_flag == 0xffffffff)
return self.valid
示例2: _read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def _read(self):
Block.read(self)
if not self.valid:
return False
# FileHeader fields
self.own_key = self._get_long(1)
self.block_count = self._get_long(2)
self.first_data = self._get_long(4)
# read (limited) data blocks table
bc = self.block_count
mbc = self.blkdev.block_longs - 56
if bc > mbc:
bc = mbc
self.data_blocks = []
for i in xrange(bc):
self.data_blocks.append(self._get_long(-51-i))
self.protect = self._get_long(-48)
self.protect_flags = ProtectFlags(self.protect)
self.byte_size = self._get_long(-47)
self.comment = self._get_bstr(-46, 79)
self.mod_ts = self._get_timestamp(-23)
self.name = self._get_bstr(-20, 30)
self.hash_chain = self._get_long(-4)
self.parent = self._get_long(-3)
self.extension = self._get_long(-2)
self.valid = (self.own_key == self.blk_num)
return self.valid
示例3: _read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def _read(self):
Block.read(self)
if not self.valid:
return False
# Comment fields
self.own_key = self._get_long(1)
self.header_key = self._get_long(2)
self.checksum = self._get_long(5)
self.comment = self._get_bstr(6, 79)
self.valid = (self.own_key == self.blk_num)
return self.valid
示例4: _read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def _read(self):
Block.read(self)
if not self.valid:
return False
# FileData fields
self.hdr_key = self._get_long(1)
self.seq_num = self._get_long(2)
self.data_size = self._get_long(3)
self.next_data = self._get_long(4)
self.valid = True
return self.valid
示例5: _read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def _read(self):
Block.read(self)
if not self.valid:
return False
# FileList fields
self.own_key = self._get_long(1)
self.block_count = self._get_long(2)
self.data_blocks = []
for i in xrange(self.block_count):
self.data_blocks.append(self._get_long(-51-i))
self.parent = self._get_long(-3)
self.extension = self._get_long(-2)
self.valid = (self.own_key == self.blk_num)
return self.valid
示例6: _read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def _read(self):
Block.read(self)
if not self.valid:
return False
# UserDir fields
self.own_key = self._get_long(1)
self.protect = self._get_long(-48)
self.comment = self._get_bstr(-46, 79)
self.mod_ts = self._get_timestamp(-23)
self.name = self._get_bstr(-20, 30)
self.hash_chain = self._get_long(-4)
self.parent = self._get_long(-3)
# hash table of entries
self.hash_table = []
self.hash_size = self.blkdev.block_longs - 56
for i in xrange(self.hash_size):
self.hash_table.append(self._get_long(6+i))
self.valid = (self.own_key == self.blk_num)
return self.valid
示例7: _read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def _read(self):
Block.read(self)
if not self.valid:
return False
# fields
self.own_key = self._get_long(1)
self.parent = self._get_long(2)
self.num_records = self._get_long(3)
self.next_cache = self._get_long(4)
self.records = []
# get records
off = 24
for i in xrange(self.num_records):
r = DirCacheRecord()
off = r.get(self.data, off)
if off == -1:
return False
self.records.append(r)
self.valid = True
return True
示例8: _read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def _read(self):
Block.read(self)
if not self.valid:
return False
# FileList fields
self.own_key = self._get_long(1)
self.block_count = self._get_long(2)
# read (limited) data blocks
bc = self.block_count
mbc = self.blkdev.block_longs - 56
if bc > mbc:
bc = mbc
self.data_blocks = []
for i in xrange(bc):
self.data_blocks.append(self._get_long(-51-i))
self.parent = self._get_long(-3)
self.extension = self._get_long(-2)
self.valid = (self.own_key == self.blk_num)
return self.valid
示例9: _read
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import read [as 别名]
def _read(self):
Block.read(self)
if not self.valid:
return False
self.valid = True
return True