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


C++ Parcel::setDataPosition方法代码示例

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


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

示例1:

TEST_F(PointerCoordsTest, Parcel) {
    Parcel parcel;

    PointerCoords inCoords;
    inCoords.clear();
    PointerCoords outCoords;

    // Round trip with empty coords.
    inCoords.writeToParcel(&parcel);
    parcel.setDataPosition(0);
    outCoords.readFromParcel(&parcel);

    ASSERT_EQ(0ULL, outCoords.bits);

    // Round trip with some values.
    parcel.freeData();
    inCoords.setAxisValue(2, 5);
    inCoords.setAxisValue(5, 8);

    inCoords.writeToParcel(&parcel);
    parcel.setDataPosition(0);
    outCoords.readFromParcel(&parcel);

    ASSERT_EQ(outCoords.bits, inCoords.bits);
    ASSERT_EQ(outCoords.values[0], inCoords.values[0]);
    ASSERT_EQ(outCoords.values[1], inCoords.values[1]);
}
开发者ID:MIPS,项目名称:frameworks-native,代码行数:27,代码来源:InputEvent_test.cpp

示例2: parse

/**
 * Check a parcel containing metadata is well formed. The header
 * is checked as well as the individual records format. However, the
 * data inside the record is not checked because we do lazy access
 * (we check/unmarshall only data the user asks for.)
 *
 * Format of a metadata parcel:
 <pre>
                     1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                     metadata total size                       |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |     'M'       |     'E'       |     'T'       |     'A'       |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                                                               |
  |                .... metadata records ....                     |
  |                                                               |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 </pre>
 *
 * @param parcel With the serialized data. Metadata keeps a
 *               reference on it to access it later on. The caller
 *               should not modify the parcel after this call (and
 *               not call recycle on it.)
 * @return false if an error occurred.
 */
bool CedarMetadata::parse(Parcel& parcel)
{
	if (parcel.dataAvail() < (size_t)kMetaHeaderSize) {
		ALOGE("Not enough data %d", parcel.dataAvail());
		return false;
	}

	const int pin = parcel.dataPosition();  // to roll back in case of errors.
	const int size = parcel.readInt32();

	// The extra kInt32Size below is to account for the int32 'size' just read.
	if (parcel.dataAvail() + kInt32Size < (size_t)size || size < kMetaHeaderSize) {
		ALOGE("Bad size %d avail %d position %d", size, parcel.dataAvail(), pin);
		parcel.setDataPosition(pin);
		return false;
	}

	// Checks if the 'M' 'E' 'T' 'A' marker is present.
	const int kShouldBeMetaMarker = parcel.readInt32();
	if (kShouldBeMetaMarker != kMetaMarker ) {
		ALOGE("Marker missing");
		parcel.setDataPosition(pin);
		return false;
	}

	// Scan the records to collect metadata ids and offsets.
	if (!scanAllRecords(parcel, size - kMetaHeaderSize)) {
		parcel.setDataPosition(pin);
		return false;
	}
	mParcel = &parcel;
	return true;
}
开发者ID:Vicent1992,项目名称:Framework_V3,代码行数:60,代码来源:CedarMetadata.cpp

示例3: readFromParcel

status_t Status::readFromParcel(const Parcel& parcel) {
    status_t status = parcel.readInt32(&mException);
    if (status != OK) {
        setFromStatusT(status);
        return status;
    }

    // Skip over fat response headers.  Not used (or propagated) in native code.
    if (mException == EX_HAS_REPLY_HEADER) {
        // Note that the header size includes the 4 byte size field.
        const int32_t header_start = parcel.dataPosition();
        int32_t header_size;
        status = parcel.readInt32(&header_size);
        if (status != OK) {
            setFromStatusT(status);
            return status;
        }
        parcel.setDataPosition(header_start + header_size);
        // And fat response headers are currently only used when there are no
        // exceptions, so act like there was no error.
        mException = EX_NONE;
    }

    if (mException == EX_NONE) {
        return status;
    }

    // The remote threw an exception.  Get the message back.
    String16 message;
    status = parcel.readString16(&message);
    if (status != OK) {
        setFromStatusT(status);
        return status;
    }
    mMessage = String8(message);

    if (mException == EX_SERVICE_SPECIFIC) {
        status = parcel.readInt32(&mErrorCode);
    } else if (mException == EX_PARCELABLE) {
        // Skip over the blob of Parcelable data
        const int32_t header_start = parcel.dataPosition();
        int32_t header_size;
        status = parcel.readInt32(&header_size);
        if (status != OK) {
            setFromStatusT(status);
            return status;
        }
        parcel.setDataPosition(header_start + header_size);
    }
    if (status != OK) {
        setFromStatusT(status);
        return status;
    }

    return status;
}
开发者ID:MIPS,项目名称:frameworks-native,代码行数:56,代码来源:Status.cpp

示例4: CheckDataEquals

    void CheckDataEquals(const Parcel& parcel, const char* content) {
        int32_t intval;
        parcel.setDataPosition(16);
        parcel.readInt32(&intval);
        parcel.setDataPosition(24);
        const char* data = (const char*) parcel.readInplace(intval);

        int32_t content_len = strlen(content);
        EXPECT_EQ(content_len, intval);
        EXPECT_TRUE(strncmp(data, content, content_len) == 0);
    }
开发者ID:MI-4i,项目名称:platform_frameworks_av,代码行数:11,代码来源:TimedTextSRTSource_test.cpp

示例5: packRILCommand

/* 
 * packRILcommandString
 * Used for packing standard AT command string to RIL command.
 * 
 * IN   *inStr      : AT command string with NULL terminate
 * IN   *prefix     : prefix of AT response
 * OUT  **outCmd    : RAW RIL command out. Caller is responsible to free this resource.
 * RETUURN          : Length of outCmd data.   
 */
size_t packRILCommand(char *inStr, char *prefix, char **outCmd)
{
	/* |Request Enum |Request Token|Number of Strings|Srings.....|
	 * |<--4 bytes-->|<--4 bytes-->|<--- 4 bytes --->|<------  ->|	
	 */
    size_t length = 0;
    char *cmdStr[2] = {NULL,NULL};
    char *pData = NULL;
    Parcel p;
    static int s_token = 0;

    if ((NULL == inStr)||(NULL == outCmd)) {
        return 0;
    }

    cmdStr[0] = inStr;
    cmdStr[1] = prefix;

   // p.writeInt32(length); /* fake write to reserve space */
    p.writeInt32(RIL_REQUEST_OEM_HOOK_STRINGS);
    p.writeInt32(s_token++);
    
    packStrings(p,cmdStr,2*sizeof(char *)); /* ONLY support 1 string now */

    length = p.dataSize();
    
#if 0
    offset = p.dataPosition(); /* Store data position */

    p.setDataPosition(0); /* Move to the buffer pointer to head */

    p.writeInt32(length - 4); /* Update data length */

    p.setDataPosition(offset); /* Restore data position */
#endif /* 0 */

    pData = (char *) malloc(length);

    if (NULL != pData) {
        memcpy(pData,p.data(),length);
        *outCmd = pData;
        LOGI("packRILCommand: %d bytes\n",length);
        printRawData((const void *) pData, length);
        
    } else {
        return 0;
    }

	return length;
}
开发者ID:SiddheshK15,项目名称:j608_fly_4511-master,代码行数:59,代码来源:ril_pupack.cpp

示例6: android_os_Parcel_setDataPosition

static void android_os_Parcel_setDataPosition(JNIEnv* env, jclass clazz, jlong nativePtr, jint pos)
{
    Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
    if (parcel != NULL) {
        parcel->setDataPosition(pos);
    }
}
开发者ID:7tiny,项目名称:platform_frameworks_base,代码行数:7,代码来源:android_os_Parcel.cpp

示例7: SurfaceComposerClient

bool
CmdImp::
initSurface()
{
    mi4SurfaceID = 0;

    // create a client to surfaceflinger
    mpSurfaceClient = new SurfaceComposerClient();

    mpSurfaceControl = mpSurfaceClient->createSurface(
        String8("surface"), mi4SurfaceID, 480, 800, PIXEL_FORMAT_RGBA_8888
    );
    SurfaceComposerClient::openGlobalTransaction();
    mpSurfaceControl->setLayer(100000);
    SurfaceComposerClient::closeGlobalTransaction();
    // pretend it went cross-process
    Parcel parcel;
    SurfaceControl::writeSurfaceToParcel(mpSurfaceControl, &parcel);
    parcel.setDataPosition(0);
    mpSurface = Surface::readFromParcel(parcel);
    mpWindow = mpSurface.get();
    //
    CAM_LOGD("setupSurface: %p", mpSurface.get());
    return  (mpSurface != 0);
}
开发者ID:SteveHuang27,项目名称:android_kernel_allview_p5_quad,代码行数:25,代码来源:Cmd_test_preview.cpp

示例8: SurfaceComposerClient

bool
CmdImp::
initSurface()
{
    mi4SurfaceID = 0;

    // create a client to surfaceflinger
    mpSurfaceClient = new SurfaceComposerClient();

#if (PLATFORM_VERSION_MAJOR == 2)
    mpSurfaceControl = mpSurfaceClient->createSurface(getpid(), 0, 480, 800, PIXEL_FORMAT_RGBA_8888, ISurfaceComposer::ePushBuffers);
#else
    mpSurfaceControl = mpSurfaceClient->createSurface(
        String8("surface"), /*mi4SurfaceID,*/ 480, 800, PIXEL_FORMAT_RGBA_8888
    );
#endif

    SurfaceComposerClient::openGlobalTransaction();
    mpSurfaceControl->setLayer(100000);
    SurfaceComposerClient::closeGlobalTransaction();
    // pretend it went cross-process
    Parcel parcel;
    SurfaceControl::writeSurfaceToParcel(mpSurfaceControl, &parcel);
    parcel.setDataPosition(0);
    mpSurface = Surface::readFromParcel(parcel);
    //
    CAM_LOGD("setupSurface: %p", mpSurface.get());
    return  (mpSurface != 0);
}
开发者ID:htc183,项目名称:android_kernel_mtk_mt6572,代码行数:29,代码来源:Cmd_test_capture.cpp

示例9: SurfaceComposerClient

bool
CmdImp::
initSurface()
{
    mi4SurfaceID = 0;

    // create a client to surfaceflinger
    mpSurfaceClient = new SurfaceComposerClient();

    mpSurfaceControl = mpSurfaceClient->createSurface(
        String8("surface"), mi4SurfaceID, 540, 960, PIXEL_FORMAT_RGBA_8888
    );
    SurfaceComposerClient::openGlobalTransaction();
    mpSurfaceControl->setLayer(100000);
    SurfaceComposerClient::closeGlobalTransaction();
    // pretend it went cross-process
    Parcel parcel;
    SurfaceControl::writeSurfaceToParcel(mpSurfaceControl, &parcel);
    parcel.setDataPosition(0);
    mpSurface = Surface::readFromParcel(parcel);
    mpWindow = mpSurface.get();
    //
/*
    printf("window=%p\n", mpWindow);
    native_window_api_connect(mpWindow, NATIVE_WINDOW_API_CAMERA);
    native_window_set_buffers_geometry(mpWindow, mpArgument->mPreviewSize.width, mpArgument->mPreviewSize.height, HAL_PIXEL_FORMAT_YV12);
    native_window_set_usage(mpWindow, GraphicBuffer::USAGE_SW_WRITE_OFTEN|GraphicBuffer::USAGE_HW_TEXTURE);
    native_window_set_scaling_mode(mpWindow, NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW);    
    native_window_set_buffers_transform(mpWindow, HAL_TRANSFORM_ROT_90);
    native_window_set_buffer_count(mpWindow, 5);
*/
    //
    CAM_LOGD("setupSurface: %p", mpSurface.get());
    return  (mpSurface != 0);
}
开发者ID:SteveHuang27,项目名称:android_kernel_allview_p5_quad,代码行数:35,代码来源:Cmd_test_prv_cb.cpp

示例10: fd

// Test SharedRegionParcel.
TEST(test_marshalling, aaudio_shared_region) {
    SharedMemoryParcelable sharedMemories[2];
    SharedRegionParcelable sharedRegionA;
    SharedRegionParcelable sharedRegionB;
    const size_t memSizeBytes = 840;
    unique_fd fd(ashmem_create_region("TestMarshalling", memSizeBytes));
    ASSERT_LE(0, fd);
    sharedMemories[0].setup(fd, memSizeBytes);
    int32_t regionOffset1 = 32;
    int32_t regionSize1 = 16;
    sharedRegionA.setup(0, regionOffset1, regionSize1);

    void *region1;
    EXPECT_EQ(AAUDIO_OK, sharedRegionA.resolve(sharedMemories, &region1));
    int32_t *buffer1 = (int32_t *)region1;
    buffer1[0] = 336677; // arbitrary value

    Parcel parcel;
    size_t pos = parcel.dataPosition();
    sharedRegionA.writeToParcel(&parcel);

    parcel.setDataPosition(pos);
    sharedRegionB.readFromParcel(&parcel);

    // should see same value
    void *region2;
    EXPECT_EQ(AAUDIO_OK, sharedRegionB.resolve(sharedMemories, &region2));
    int32_t *buffer2 = (int32_t *)region2;
    EXPECT_EQ(buffer1[0], buffer2[0]);
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:31,代码来源:test_marshalling.cpp

示例11: onTransact

status_t BnMcuService::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
	ALOGI("BnMcuService::onTransact, code[%d]", code);
    switch (code) {
        case GET_TEST: {
            CHECK_INTERFACE(IMcuService, data, reply);
            int result = getTest();
            reply->writeInt32(result);
            return NO_ERROR;
        } break;
		case obtain_info: {
            CHECK_INTERFACE(IMcuService, data, reply);
			int domain = data.readInt32();
			int cmd = data.readInt32();
			Parcel out;
            bool res = obtainInfo(domain, cmd, out);
			reply->appendFrom(&out, 0, out.dataSize());
			reply->writeInt32(res?1:0);
			out.freeData();
            return NO_ERROR;
        } break;
		case send_info: {
            CHECK_INTERFACE(IMcuService, data, reply);
			int domain = data.readInt32();
			int cmd = data.readInt32();
			Parcel in;
			if(data.dataAvail() >0)
			{
				in.appendFrom(&data, data.dataPosition(), data.dataSize()-data.dataPosition());
				in.setDataPosition(0);
			}
			bool res = sendInfo(domain, cmd, in);
			reply->writeInt32(res?1:0);
			in.freeData();
            return NO_ERROR;
        } break;
		case regist_data_changed_listener: {
            CHECK_INTERFACE(IMcuService, data, reply);
			int domain = data.readInt32();
           	sp<IDataChangedListener> client = interface_cast<IDataChangedListener>(data.readStrongBinder());
            bool res = registDataChanagedListener(domain, client);
            reply->writeInt32((res?1:0));
            return NO_ERROR;
        } break; 
		case unregist_data_changed_listener: {
            CHECK_INTERFACE(IMcuService, data, reply);
			int domain = data.readInt32();
           	sp<IDataChangedListener> client = interface_cast<IDataChangedListener>(data.readStrongBinder());
            bool res = unregistDataChanagedListener(domain, client);
            reply->writeInt32((res?1:0));
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
开发者ID:liujiangang,项目名称:BinderServer,代码行数:57,代码来源:IMcuService.cpp

示例12: clientInit

int MokoidSurface::clientInit(int x, int y, int w, int h, int *stride)
{
	int depth = 16;
	int fmt;

	surfaceflinger_client = new SurfaceComposerClient;
	if (surfaceflinger_client == NULL) {
		LOGE("failed to create client\n");
		return 0;
	}

	fmt = getFormat(depth);
	if (fmt == PIXEL_FORMAT_UNKNOWN) {
		LOGE("failed to find a format for depth %d\n", depth);
		return 0;
	}

	// Refactor in Android 4.0
	surfaceflinger_surfaceControl = 
		surfaceflinger_client->createSurface(getpid(), 0, w, h, fmt);
	if (surfaceflinger_surfaceControl == NULL) {
		LOGE("failed to create surfaceControl\n");
		return 0;
	}

	// Refactor in Android 4.0
	surfaceflinger_surface = surfaceflinger_surfaceControl->getSurface();

	//surfaceflinger_client->openGlobalTransaction();
	SurfaceComposerClient::openGlobalTransaction();
	surfaceflinger_surfaceControl->setPosition(x, y);
	surfaceflinger_surfaceControl->setLayer(INT_MAX);
	//surfaceflinger_client->closeGlobalTransaction();
	SurfaceComposerClient::closeGlobalTransaction();

	if (stride)
		*stride = w * depth / 8;

	// Get native window
	Parcel parcel;
	SurfaceControl::writeSurfaceToParcel(surfaceflinger_surfaceControl, &parcel);
	parcel.setDataPosition(0);
	sp<Surface> surface = Surface::readFromParcel(parcel);
	ANativeWindow* window = surface.get();

	LOGI("mokoid native window = %p", window);

	int err = native_window_set_buffer_count(window, 4);
	ANativeWindowBuffer* buffer;

	for (int i = 0; i < 4; i++) {
		window->dequeueBuffer(window, &buffer);
		LOGI("mokoid buffer %d: %p\n", i, buffer);
	}

	return 1;
}
开发者ID:jollen,项目名称:mokoid-full,代码行数:57,代码来源:MokoidSurface.cpp

示例13: incomingThread

int PhoneMachine::incomingThread()
{
	char boardname[PROPERTY_VALUE_MAX];
	if (property_get("ro.product.board", boardname, "") > 0) {
		SLOGV("%s: -------------Board %s -----------------\n", __FUNCTION__, boardname);
		// QCOM Version 4.1.2 onwards, supports multiple clients and needs a SUB1/2 string to
		// identify client
		// For this example code we will just use "SUB1" for client 0
		if ( !strcasecmp(boardname, "msm8960")) {
			char *sub = "SUB1";
			int ret = ::send(mRILfd, sub, sizeof(sub), 0);
			if (ret != (int) sizeof(sub)) {
	    		perror("Socket write error when sending parcel"); 
	    		return ret;
			}
			SLOGV("%s: sent SUB1\n", __FUNCTION__);
		}
	}
	else SLOGE("%s: could not get device name\n", __FUNCTION__);

    while (1) {
	uint32_t header;
	int ret = read(mRILfd, &header, sizeof(header));

	if (ret != sizeof(header)) {
	    SLOGW("Read %d bytes instead of %d\n", ret, sizeof(header));
	    perror("PhoneMachine::incomingThread read on header");
	    return ret;
	}
	int data_size = ntohl(header);
	Parcel data;
	ret = read(mRILfd, data.writeInplace(data_size), data_size);
	if (ret != data_size) {
	    perror("PhoneMachine::incomingThread read on payload");
	    return ret;
	}
	if (mDebug & DEBUG_INCOMING) {
	    SLOGV("<<<<<<< INCOMING <<<<<<<<<<\n");
	    const uint8_t *ptr = data.data();
	    for (int i = 0 ; i < data_size ; i++ ) {
		SLOGV("%02x ", *ptr++);
		if ((i+1) % 8 == 0 || (i+1 >= data_size))
		    SLOGV("\n");
	    }
	    SLOGV("<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
	}
	data.setDataPosition(0);
	int type = data.readInt32();
//	SLOGV("New message received: %d bytes type=%s\n", data_size, 
//	       (type ==RESPONSE_SOLICITED ? "solicited" : "unsolicited"));
	if (type == RESPONSE_SOLICITED) 
	    receiveSolicited(data);
	else
	    receiveUnsolicited(data);
    }
    return NO_ERROR;
}
开发者ID:cambridgehackers,项目名称:klaatu-services,代码行数:57,代码来源:PhoneStateMachine.cpp

示例14: scanAllRecords

/**
 * Go over all the records, collecting metadata keys and records'
 * type field offset in the Parcel. These are stored in
 * mKeyToPosMap for latter retrieval.
 * Format of a metadata record:
 <pre>
                     1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                     record size                               |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                     metadata key                              |  // TITLE
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                     metadata type                             |  // STRING_VAL
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                                                               |
  |                .... metadata payload ....                     |
  |                                                               |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 </pre>
 * @param parcel With the serialized records.
 * @param bytesLeft How many bytes in the parcel should be processed.
 * @return false if an error occurred during parsing.
 */
bool CedarMetadata::scanAllRecords(Parcel& parcel, int bytesLeft)
{
	int recCount = 0;
	bool error = false;
	
	mKeyToPosMap.clear();
	while (bytesLeft > kRecordHeaderSize) {
		const int start = parcel.dataPosition();
		const int size = parcel.readInt32();

		if (size <= kRecordHeaderSize) {  // at least 1 byte should be present.
			ALOGE("Record is too short");
			error = true;
			break;
		}

		// Check the metadata key.
		static int metadataId = parcel.readInt32();
		if (!checkMetadataId(metadataId)) {
			error = true;
			break;
		}

		// Store the record offset which points to the type
		// field so we can later on read/unmarshall the record
		// payload.
		if (mKeyToPosMap.indexOfKey(metadataId) >= 0) {
			ALOGE("Duplicate metadata ID found");
			error = true;
			break;
		}

		mKeyToPosMap.add(metadataId, parcel.dataPosition());

		// Check the metadata type.
		const int metadataType = parcel.readInt32();
		if (metadataType <= 0 || metadataType > LAST_TYPE) {
			ALOGE("Invalid metadata type %d", metadataType);
			error = true;
			break;
		}

		// Skip to the next one.
		parcel.setDataPosition(start + size);
		bytesLeft -= size;
		++recCount;
	}

	if (0 != bytesLeft || error) {
		ALOGE("Ran out of data or error on record %d", recCount);
		mKeyToPosMap.clear();
		return false;
	} else {
		return true;
	}
}
开发者ID:Vicent1992,项目名称:Framework_V3,代码行数:80,代码来源:CedarMetadata.cpp

示例15:

// Test adding one value.
TEST(test_marshalling, aaudio_one_read_write) {
    Parcel parcel;
    size_t pos = parcel.dataPosition();
    const int arbitraryValue = 235;
    parcel.writeInt32(arbitraryValue);
    parcel.setDataPosition(pos);
    int32_t y;
    parcel.readInt32(&y);
    EXPECT_EQ(arbitraryValue, y);
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:11,代码来源:test_marshalling.cpp


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