-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor and improve code quality * More changes * Remove commented code * Rearrange * Fix issues
- Loading branch information
Showing
16 changed files
with
135 additions
and
200 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class BytearrayIterator: | ||
def __init__(self, data: bytearray) -> None: | ||
self.__data = data | ||
self.__ptr = 0 | ||
|
||
def seek_ptr_pos(self, pos: int) -> None: | ||
self.__ptr = pos | ||
|
||
def get_cur_ptr_pos(self) -> int: | ||
return self.__ptr | ||
|
||
def get_n_bytes(self, n: int) -> bytearray: | ||
cur_ptr_pos = self.get_cur_ptr_pos() | ||
return self.__data[cur_ptr_pos : cur_ptr_pos + n] | ||
|
||
def get_n_bytes_and_move(self, n: int) -> bytearray: | ||
data = self.get_n_bytes(n) | ||
self.seek_ptr_pos(self.get_cur_ptr_pos() + n) | ||
return data |
Oops, something went wrong.