@Implementation(minSdk = LOLLIPOP) @SuppressWarnings("robolectric.ShadowReturnTypeMismatch") protected static void nativeSetDataSize(long nativePtr, int size) { NATIVE_PTR_TO_PARCEL.get(nativePtr).setDataSize(size); }
/** * Appends the contents of the other byte buffer to this byte buffer starting at offset and * ending at length. * * @param other ByteBuffer to append to this one * @param offset number of bytes from beginning of byte buffer to start copy from * @param length number of bytes to copy */ public void appendFrom(ByteBuffer other, int offset, int length) { int oldSize = dataSize; if (dataPosition != dataSize) { // Parcel.cpp will always expand the buffer by length even if it is overwriting existing // data, yielding extra uninitialized data at the end, in contrast to write methods that // won't increase the data length if they are overwriting in place. This is surprising // behavior that production code should avoid. throw new UnreliableBehaviorError( "Real Android parcels behave unreliably if appendFrom is " + "called from any position other than the end"); } setDataSize(oldSize + length); // Just blindly copy whatever happens to be in the buffer. Reads will validate whether any // of the objects were only incompletely copied. System.arraycopy(other.data, offset, data, dataPosition, length); dataPosition += length; failNextReadIfPastEnd = true; }
byteBuffer.setDataSize(length); byteBuffer.writeItem(new FakeEncodedItem(length, new byte[length])); return byteBuffer;
@Implementation(minSdk = LOLLIPOP) public static void nativeSetDataSize(long nativePtr, int size) { NATIVE_PTR_TO_PARCEL.get(nativePtr).setDataSize(size); }
@Implementation(minSdk = LOLLIPOP) public static void nativeSetDataSize(long nativePtr, int size) { NATIVE_PTR_TO_PARCEL.get(nativePtr).setDataSize(size); }
@Implementation @HiddenApi public static void nativeSetDataSize(long nativePtr, int size) { NATIVE_PTR_TO_PARCEL.get(nativePtr).setDataSize(size); }
@Implementation(minSdk = LOLLIPOP) @SuppressWarnings("robolectric.ShadowReturnTypeMismatch") protected static void nativeSetDataSize(long nativePtr, int size) { NATIVE_PTR_TO_PARCEL.get(nativePtr).setDataSize(size); }