Code example for Parcel

Methods: setDataPosition, writeInt

0
        mParcel.setDataPosition(pos);
    } 
 
    // Rewind the parcel and insert the header. 
    private void resetParcel() { 
        mParcel.setDataPosition(0);
        // Most tests will use a properly formed parcel with a size 
        // and the meta marker so we add them by default. 
        mParcel.writeInt(-1);  // Placeholder for the size
        mParcel.writeInt(kMarker);
    } 
 
    // ---------------------------------------------------------------------- 
    // START OF THE TESTS 
 
 
    // There should be at least 8 bytes in the parcel, 4 for the size 
    // and 4 for the 'M' 'E' 'T' 'A' marker. 
    @SmallTest 
    public void testMissingSizeAndMarker() throws Exception { 
        for (int i = 0; i < kHeaderSize; ++i) {