当前位置: 首页>>代码示例>>C++>>正文


C++ ArrayOf::Copy方法代码示例

本文整理汇总了C++中ArrayOf::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayOf::Copy方法的具体用法?C++ ArrayOf::Copy怎么用?C++ ArrayOf::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayOf的用法示例。


在下文中一共展示了ArrayOf::Copy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestIsMarkSupported

/*
 *
 * Ԥ�ڽ��: OK
 *
 * ���з�ʽ: clPushBackInputStream.ecx 6
 */
  int CTest::TestIsMarkSupported(int argc,char *argv[])
{
    IByteArrayInputStream* in;

    ArrayOf<Byte>* buffer = ArrayOf<Byte>::Alloc(3328);
    const char * str = (const char*) m_text;
    buffer->Copy((Byte*) str, 3328);

    ECode rt = CByteArrayInputStream::New(buffer, &in);
    if ( 0 == rt)
        rt = CPushbackInputStream::New((IInputStream*)in, &m_pis);

    Boolean supported;
    if (0 == rt) {
        rt = m_pis->IsMarkSupported(&supported);
    }

    if (0 == rt) {
        printf("test 6:OK\n");
    }
    else {
        printf("test 6 ERR: rt = %d\n", rt);
    }
    if(in) in->Release();
    if(m_pis) m_pis->Release();
    ArrayOf<Byte>::Free(buffer);

    return 0;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:35,代码来源:test.cpp

示例2: TestAvailable

/*
 *
 * ���: OK
 *
 * ���з�ʽ: clPushBackInputStream.ecx 3
 */
 int CTest::TestAvailable(int argc,char *argv[])
{
    IByteArrayInputStream* in;

    ArrayOf<Byte>* buffer = ArrayOf<Byte>::Alloc(3328);
    const char * str = (const char*) m_text;
    buffer->Copy((Byte*) str, 3328);

    ECode rt = CByteArrayInputStream::New(buffer, &in);
    if ( 0 == rt)
        rt = CPushbackInputStream::New((IInputStream*)in, &m_pis);

    Int32 number;
    if (0 == rt) {
        rt = m_pis->Available(&number);
    }

    if (0 == rt) {
        printf("test 3:OK\n");
    }
    else {
        printf("test3 ERR: rt = %d\n", rt);
    }
    if(in) in->Release();
    if(m_pis) m_pis->Release();
    ArrayOf<Byte>::Free(buffer);

    return 0;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:35,代码来源:test.cpp

示例3: TestClose

/*
 *
 * ���: OK
 *
 * ���з�ʽ: clLineNumberReader.ecx 3
 */
 int CTest::TestClose(int argc,char *argv[])
{
    ICharArrayReader * ir;

    ArrayOf<Char8>* buffer = ArrayOf<Char8>::Alloc(1024);
    if (buffer == NULL) return E_OUT_OF_MEMORY_ERROR;
    const char * str = (const char*) m_text;
    buffer->Copy((Char8*) str, 1024);

    ECode rt = CCharArrayReader::New(buffer, &ir);

    if (rt == 0) {
        rt = CLineNumberReader::New((IReader*)ir, &m_lnr);
        if (rt == 0) rt = m_lnr->Close();

    }

    if (0 == rt) {
        printf("test 3:OK\n");
    }
    else {
        printf("test 3 ERR: rt = %d\n", rt);
    }
    if(ir) ir->Release();
    if(m_lnr) m_lnr->Release();
    ArrayOf<Char8>::Free(buffer);

    return 0;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:35,代码来源:test.cpp

示例4: TestReadBufferEx

 /*
 * Ԥ�ڽ��: OK
 *
 * ���з�ʽ: clLineNumberReader.ecx 8
 *
 */
  int CTest::TestReadBufferEx(int argc,char *argv[])
{
    ICharArrayReader * ir;

    ArrayOf<Char8>* buffer = ArrayOf<Char8>::Alloc(1024);
    if (buffer == NULL) return E_OUT_OF_MEMORY_ERROR;
    const char * str = (const char*) m_text;
    buffer->Copy((Char8*) str, 1024);

    ECode rt = CCharArrayReader::New(buffer, &ir);

    if (rt == 0) {
        rt = CLineNumberReader::New((IReader*)ir, &m_lnr);
    }
    Int32 value = 0;
    ArrayOf<Char8>* buf = (ArrayOf<Char8>*) malloc(sizeof(ArrayOf<Char8>*));
    if (rt == 0) {
        rt = m_lnr->ReadBufferEx(0, 0, buf, &value);
    }
    if (0 == rt) {
        printf("test 8:OK\n");
    }
    else {
        printf("test 8 ERR: rt = %d\n", rt);
    }
    if(ir) ir->Release();
    if(m_lnr) m_lnr->Release();
    ArrayOf<Char8>::Free(buffer);
    free(buf);

    return 0;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:38,代码来源:test.cpp

示例5: TestUnReadBufferEx

 /*
 * Ԥ�ڽ��: OK
 *
 * ���з�ʽ: clPushbackReader.ecx 14
 */
  int CTest::TestUnReadBufferEx(int argc,char *argv[])
{
    ICharArrayReader * ir;

    ArrayOf<Char8>* buffer = ArrayOf<Char8>::Alloc(1024);
    if (buffer == NULL) return E_OUT_OF_MEMORY_ERROR;
    const char * str = (const char*) m_text;
    buffer->Copy((Char8*) str, 1024);

    ECode rt = CCharArrayReader::New(buffer, &ir);

    if (rt == 0) {
        rt = CPushbackReader::New((IReader*)ir, &m_pr);
    }
    if (0 == rt) {
        rt = m_pr->UnReadBufferEx(0, 0, *buffer);
    }
    if (0 == rt) {
        printf("test 14:OK\n");
    }
    else {
        printf("test 14 ERR: rt = %d\n", rt);
    }
    if(ir) ir->Release();
    if(m_pr) m_pr->Release();
    ArrayOf<Char8>::Free(buffer);
    return 0;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:33,代码来源:test.cpp

示例6: main

int main(int argc, char *argv[])
{
    ECode ec = NOERROR;
    ArrayOf<Byte> *buffer = ArrayOf<Byte>::Alloc(1024);
    Int32 len;

    IFileOutputStream *pfo = NULL;
    ec = CFileOutputStream::New(String("/data/data/com.elastos.runtime/elastos/tstbuffer.txt"), &pfo);
    if (FAILED(ec)) {
    	printf("Cann't Create CFileOutputStream, ec = %x\n", ec);
        return -1;
    }


    IBufferedOutputStream *pbos = NULL;
    ec = CBufferedOutputStream::New((IFileOutputStream *)pfo, &pbos);
    if (FAILED(ec)) {
    	printf("Cann't Create CZipOutputStream, ec = %x\n", ec);
        return -1;
    }

    Int32 i = 0;

    buffer->Copy((Byte *)"random", 6);
    while(i < 100) {
        ec = pbos->WriteBufferEx(0, 6, *buffer);
        if (FAILED(ec)) {
            printf("WriteBufferEx Failed! ec = %x\n", ec);
            return -1;
        }
        pbos->Flush();
        //buffer->Copy((Byte *)&i, 4);
        i++;
    }
    printf("==============================================\n");
    pbos->Close();
    return 0;

}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:39,代码来源:test.cpp


注:本文中的ArrayOf::Copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。