am bac00601: am dc69e6e8: am be52f0d1: Add read/writeBlob to Parcel

* commit 'bac0060104d359bcc2d745082546c58828bec972':
  Add read/writeBlob to Parcel
This commit is contained in:
Sandeep Siddhartha
2014-07-26 00:20:40 +00:00
committed by Android Git Automerger
2 changed files with 83 additions and 0 deletions

View File

@@ -246,6 +246,7 @@ public final class Parcel {
private static native void nativeRestoreAllowFds(long nativePtr, boolean lastValue);
private static native void nativeWriteByteArray(long nativePtr, byte[] b, int offset, int len);
private static native void nativeWriteBlob(long nativePtr, byte[] b, int offset, int len);
private static native void nativeWriteInt(long nativePtr, int val);
private static native void nativeWriteLong(long nativePtr, long val);
private static native void nativeWriteFloat(long nativePtr, float val);
@@ -255,6 +256,7 @@ public final class Parcel {
private static native void nativeWriteFileDescriptor(long nativePtr, FileDescriptor val);
private static native byte[] nativeCreateByteArray(long nativePtr);
private static native byte[] nativeReadBlob(long nativePtr);
private static native int nativeReadInt(long nativePtr);
private static native long nativeReadLong(long nativePtr);
private static native float nativeReadFloat(long nativePtr);
@@ -478,6 +480,16 @@ public final class Parcel {
nativeWriteByteArray(mNativePtr, b, offset, len);
}
/**
* Write a blob of data into the parcel at the current {@link #dataPosition},
* growing {@link #dataCapacity} if needed.
* @param b Bytes to place into the parcel.
* {@hide}
*/
public final void writeBlob(byte[] b) {
nativeWriteBlob(mNativePtr, b, 0, (b != null) ? b.length : 0);
}
/**
* Write an integer value into the parcel at the current dataPosition(),
* growing dataCapacity() if needed.
@@ -1699,6 +1711,14 @@ public final class Parcel {
}
}
/**
* Read a blob of data from the parcel and return it as a byte array.
* {@hide}
*/
public final byte[] readBlob() {
return nativeReadBlob(mNativePtr);
}
/**
* Read and return a String[] object from the parcel.
* {@hide}