BufferInputSource::BufferInputSource(std::string const& description,
                                     std::string const& contents) :
    own_memory(true),
    description(description),
    buf(0),
    cur_offset(0)
{
    this->buf = new Buffer(contents.length());
    unsigned char* bp = buf->getBuffer();
    memcpy(bp, contents.c_str(), contents.length());
}
BufferInputSource::BufferInputSource(std::string const& description,
                                     std::string const& contents) :
    own_memory(true),
    description(description),
    buf(0),
    cur_offset(0)
{
    this->buf = new Buffer(contents.length());
    unsigned char* bp = buf->getBuffer();
    memcpy(bp, contents.c_str(), contents.length());
}