| 24 | |
| 25 | # Read Some Data |
| 26 | def read(self, index, size): |
| 27 | assert type(index) is int and 0 <= index < self.__end |
| 28 | assert type(size) is int and index < index + size <= self.__end |
| 29 | first_index = index |
| 30 | last_index = index + size - 1 |
| 31 | first_block = first_index / self.__size + 1 |
| 32 | last_block = last_index / self.__size + 2 |
| 33 | stream = ''.join([self.__read(block) for block in \ |
| 34 | range(first_block, last_block)]) |
| 35 | first_index = index % self.__size |
| 36 | last_index = first_index + size |
| 37 | return stream[first_index:last_index] |
| 38 | |
| 39 | # Write Some Data |
| 40 | def write(self, index, data): |