示例#1
0
CX_OBJECT_FREE(cxStream, cxObject)
{
    if(this->isOpen){
        cxStreamClose(this);
    }
    CX_RELEASE(this->path);
    CX_RELEASE(this->file);
    CX_METHOD_RELEASE(this->Read);
    CX_METHOD_RELEASE(this->Write);
    CX_METHOD_RELEASE(this->Open);
    CX_METHOD_RELEASE(this->Seek);
    CX_METHOD_RELEASE(this->AllBytes);
    CX_METHOD_RELEASE(this->Close);
    CX_METHOD_RELEASE(this->Position);
}
示例#2
0
static cxString cxMp3StreamAllBytes(cxAny stream)
{
    cxStream this = stream;
    if(!this->canRead){
        cxStreamOpen(this);
    }
    if(!this->canRead){
        CX_ERROR("file stream can't read");
        return NULL;
    }
    cxInt bufsiz = 0;
    cxPointer buffer = cxMp3StreamBuffer(this, &bufsiz);
    cxString data = CX_CREATE(cxString);
    cxInt bytes = 0;
    while((bytes = cxStreamRead(this,buffer,bufsiz)) > 0){
        cxStringAppend(data, buffer,bytes);
    }
    cxStreamClose(this);
    return data;
}
示例#3
0
static cxInt cxStreamLuaClose(lua_State *L)
{
    CX_LUA_DEF_THIS(cxStream);
    cxStreamClose(this);
    return 0;
}