Non compressing png writer is ok.
This commit is contained in:
parent
33369b1775
commit
e4f9393ee7
18 changed files with 196 additions and 23 deletions
|
@ -1,7 +1,11 @@
|
|||
#include "File.h"
|
||||
|
||||
#include "FileLogger.h"
|
||||
#include "ByteUtils.h"
|
||||
|
||||
#include <streambuf>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
File::File(std::filesystem::path path)
|
||||
: mFullPath(path),
|
||||
|
@ -22,6 +26,30 @@ void File::SetAccessMode(AccessMode mode)
|
|||
mAccessMode = mode;
|
||||
}
|
||||
|
||||
std::string File::dumpBinary()
|
||||
{
|
||||
mAccessMode = AccessMode::Read;
|
||||
Open();
|
||||
|
||||
std::stringstream sstr;
|
||||
sstr << "Count | Binary | Decimal | ASCII \n";
|
||||
unsigned count = 0;
|
||||
while(mInHandle->peek() != EOF)
|
||||
{
|
||||
const unsigned char val = static_cast<unsigned char>(mInHandle->get());
|
||||
const unsigned char ascii_val = std::isalpha(val) ? val : '.';
|
||||
sstr << count << " | " << ByteUtils::toString(val) << " | " << static_cast<int>(val) << " | " << ascii_val << '\n';
|
||||
if (count < 0 && count % 10 == 0)
|
||||
{
|
||||
sstr << "\n";
|
||||
}
|
||||
count++;
|
||||
}
|
||||
const auto out = sstr.str();
|
||||
Close();
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ifstream* File::GetInHandle() const
|
||||
{
|
||||
return mInHandle.get();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue