pype32.utils.ReadData

Package pype32 :: Module utils :: Class ReadData |
[hide private]
[frames] | no frames]

# Class ReadData

source code

    object --+
             |
            ReadData

Returns a ReadData-like stream object.

Instance Methods | [hide private]
__init__(self, data, endianness=`'``<``'`, signed=False) x.__init__(...) initializes x; see help(type(x)) for signature | source code
__len__(self) | source code
int |
readDword(self) Reads a dword value from the ReadData stream object. | source code
int |
readWord(self) Reads a word value from the ReadData stream object. | source code
int |
readByte(self) Reads a byte value from the ReadData stream object. | source code
int |
readQword(self) Reads a qword value from the ReadData stream object. | source code
str |
readString(self) Reads an ASCII string from the ReadData stream object. | source code
str |
readAlignedString(self, align=4) Reads an ASCII string aligned to the next align-bytes boundary. | source code
str |
read(self, nroBytes) Reads data from the ReadData stream object. | source code
skipBytes(self, nroBytes) Skips the specified number as parameter to the current value of the ReadData stream. | source code
setOffset(self, value) Sets the offset of the ReadData stream object in wich the data is read. | source code
str |
readAt(self, offset, size) Reads as many bytes indicated in the size parameter at the specific offset. | source code
int |
tell(self) Returns the current position of the offset in the ReadData sream object. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, data, endianness=`'``<``'`, signed=False) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Parameters: `data` (str) - The data from which we want to read. `endianness` (str) - (Optional) Indicates the endianness used to read the data. The `<` indicates little-endian while `>` indicates big-endian. `signed` (bool) - (Optional) If set to `True` the data will be treated as signed. If set to `False` it will be treated as unsigned. Overrides: object.__init__

### readDword(self) | source code
Reads a dword value from the ReadData stream object. Returns: int The dword value read from the ReadData stream.

### readWord(self) | source code
Reads a word value from the ReadData stream object. Returns: int The word value read from the ReadData stream.

### readByte(self) | source code
Reads a byte value from the ReadData stream object. Returns: int The byte value read from the ReadData stream.

### readQword(self) | source code
Reads a qword value from the ReadData stream object. Returns: int The qword value read from the ReadData stream.

### readString(self) | source code
Reads an ASCII string from the ReadData stream object. Returns: str An ASCII string read form the stream.

### readAlignedString(self, align=4) | source code
Reads an ASCII string aligned to the next align-bytes boundary. Parameters: `align` (int) - (Optional) The value we want the ASCII string to be aligned. Returns: str A 4-bytes aligned (default) ASCII string.

### read(self, nroBytes) | source code
Reads data from the ReadData stream object. Parameters: `nroBytes` (int) - The number of bytes to read. Returns: str A string containing the read data from the ReadData stream object. Raises: `DataLengthException` - The number of bytes tried to be read are more than the remaining in the ReadData stream.

### skipBytes(self, nroBytes) | source code
Skips the specified number as parameter to the current value of the ReadData stream. Parameters: `nroBytes` (int) - The number of bytes to skip.

### setOffset(self, value) | source code
Sets the offset of the ReadData stream object in wich the data is read. Parameters: `value` (int) - Integer value that represent the offset we want to start reading in the ReadData stream. Raises: `WrongOffsetValueException` - The value is beyond the total length of the data.

### readAt(self, offset, size) | source code
Reads as many bytes indicated in the size parameter at the specific offset. Parameters: `offset` (int) - Offset of the value to be read. `size` (int) - This parameter indicates how many bytes are going to be read from a given offset. Returns: str A packed string containing the read data.

### tell(self) | source code
Returns the current position of the offset in the ReadData sream object. Returns: int The value of the current offset in the stream.