Exemple #1
0
size_t hsRAMStream::read(size_t size, void* buf) {
    if (size + fPos > fSize)
        throw hsFileReadException(__FILE__, __LINE__, "Read past end of buffer");
    memcpy(buf, fData + fPos, size);
    fPos += size;
    return size;
}
Exemple #2
0
size_t pfSizedStream::write(size_t size, const void* buf) {
    if (pos() + size > fLength) { // pos() is the index in the sub-stream
        throw hsFileReadException(__FILE__, __LINE__, plString::Format("Write past end of sized stream: %d bytes requested, %d available",
                         size, (fLength - pos())));
    }

    return fBase->write(size, buf);
}
Exemple #3
0
void pfSizedStream::skip(int32_t count) {
    if (pos() + count > fLength) { // pos() is the index in the sub-stream
        throw hsFileReadException(__FILE__, __LINE__, plString::Format("Seek out of range: %d bytes requested, %d available",
                         count, (fLength - pos())));
    }

    fBase->skip(count);
}
Exemple #4
0
size_t pfSizedStream::read(size_t size, void* buf) {
    if (pos() + size > fLength) { // pos() is the index in the sub-stream
        throw hsFileReadException(__FILE__, __LINE__,
                         ST::format("Read past end of sized stream: {} bytes requested, {} available",
                         size, (fLength - pos())).c_str());
    }

    return fBase->read(size, buf);
}