34 #include "io_helpers.h"
35 #include "id3/utils.h"
44 BString str(data, len);
45 size = dami::min(len, this->SetBinary(str));
61 size_t fixed = _fixed_size;
69 _binary.assign(data, 0, dami::min(size, fixed));
72 _binary.append(fixed - size,
'\0');
75 size = _binary.size();
97 data = _binary.data();
120 bytes = dami::min(max_bytes, this->Size());
121 if (
NULL != buffer && bytes > 0)
123 ::memcpy(buffer, _binary.data(), bytes);
144 FILE* temp_file = ::fopen(info,
"rb");
145 if (temp_file !=
NULL)
147 ::fseek(temp_file, 0, SEEK_END);
148 size_t fileSize = ::ftell(temp_file);
149 ::fseek(temp_file, 0, SEEK_SET);
154 ::fread(buffer, 1, fileSize, temp_file);
156 this->Set(buffer, fileSize);
180 size_t size = this->Size();
183 FILE* temp_file = ::fopen(info,
"wb");
184 if (temp_file !=
NULL)
186 ::fwrite(_binary.data(), 1, size, temp_file);
199 _binary = io::readAllBinary(reader);
205 writer.
writeChars(this->GetRawBinary(), this->Size());