Cocos2d-x 4.0 Bug in Data readData = FileUtils::getInstance()->getDataFromFile(path);

I can’t get the arrayBytes in this code

   auto callback = [&](RenderTexture* rt, const std::string& path)
            {
///From Cpp-Test FileUtils
                  Data readData = FileUtils::getInstance()->getDataFromFile(path);
                  buffer = (unsigned char*)malloc(sizeof(unsigned char) * (readData.getSize() + 1));
                  memcpy(buffer, readData.getBytes(), readData.getSize());
                  buffer[readData.getSize()] = '\0';
                  std::string readDataStr((const char*)buffer);
                  free(buffer);
            };
            _target-> saveToFileAsNonPMA(png, Image::Format::PNG, true, callback);

only get this "\x89PNG\r\n\x1a\n\0\0\0\rIHDR\0\0\x04\0\0\0\x02@\b\x06\0\0\0\x13\x95\x14�

but if I used the android java open file I get the whole File

It was truncated by strlen when construct std::string, please just use FileUtils::getInstance()->getStringFromFile(path), it will return std::string without truncate directly