Class to manage an input file stream given for the analysis.
More...
#include <kunaistream.hpp>
|
| KunaiStream (std::ifstream &input_file) |
| Constructor from KunaiStream class.
|
|
| ~KunaiStream ()=default |
| Destructor from KunaiStream, nothing done here for the moment.
|
|
std::size_t | get_size () const |
| Obtain the size of the file.
|
|
template<typename T > |
void | read_data (T &buffer, std::int32_t read_size) |
| Read data given a buffer of a T data type and with a size specified by the user.
|
|
std::streampos | tellg () const |
| Obtain the current pointer of the file.
|
|
void | seekg (std::streamoff off, std::ios_base::seekdir dir) |
| Move the pointer from the input file.
|
|
std::string | read_ansii_string (std::int64_t offset) |
| Read a string as an array of char finished in a 0 byte.
|
|
std::string | read_dex_string (std::int64_t offset) |
| Read a DEX string, the dex string contains the next format: <size in uleb128><string with size>
|
|
std::uint64_t | read_uleb128 () |
| Read a number in uleb128 format.
|
|
std::int64_t | read_sleb128 () |
| Read a number in sleb128 format.
|
|
|
const std::int32_t | MAX_ANSII_STR_SIZE = 256 |
| maximum size for ansii strings
|
|
Class to manage an input file stream given for the analysis.
◆ KunaiStream()
KUNAI::stream::KunaiStream::KunaiStream |
( |
std::ifstream & |
input_file | ) |
|
|
inline |
Constructor from KunaiStream class.
- Parameters
-
input_file | file for the analysis this must be an std::ifstream |
◆ get_size()
std::size_t KUNAI::stream::KunaiStream::get_size |
( |
| ) |
const |
|
inline |
Obtain the size of the file.
- Returns
- std::size_t with the calculated file size
◆ read_ansii_string()
std::string KUNAI::stream::KunaiStream::read_ansii_string |
( |
std::int64_t |
offset | ) |
|
Read a string as an array of char finished in a 0 byte.
- Parameters
-
offset | the offset in the file where to read the string |
- Returns
- string read
◆ read_data()
template<typename T >
void KUNAI::stream::KunaiStream::read_data |
( |
T & |
buffer, |
|
|
std::int32_t |
read_size |
|
) |
| |
|
inline |
Read data given a buffer of a T data type and with a size specified by the user.
- Template Parameters
-
T | type of the buffer where to read the data |
- Parameters
-
buffer | Buffer where to read the data from the file. |
read_size | size to read |
◆ read_dex_string()
std::string KUNAI::stream::KunaiStream::read_dex_string |
( |
std::int64_t |
offset | ) |
|
Read a DEX string, the dex string contains the next format: <size in uleb128><string with size>
- Parameters
-
offset | the offset in the file where to read the string |
- Returns
- string read
◆ read_sleb128()
std::int64_t KUNAI::stream::KunaiStream::read_sleb128 |
( |
| ) |
|
Read a number in sleb128 format.
- Returns
- int64_t with the number
◆ read_uleb128()
std::uint64_t KUNAI::stream::KunaiStream::read_uleb128 |
( |
| ) |
|
Read a number in uleb128 format.
- Returns
- uint64_t with the number
◆ seekg()
void KUNAI::stream::KunaiStream::seekg |
( |
std::streamoff |
off, |
|
|
std::ios_base::seekdir |
dir |
|
) |
| |
|
inline |
Move the pointer from the input file.
- Parameters
-
off | offset where to move |
dir | directorion to move |
◆ tellg()
std::streampos KUNAI::stream::KunaiStream::tellg |
( |
| ) |
const |
|
inline |
Obtain the current pointer of the file.
- Returns
- position of file
The documentation for this class was generated from the following file: