下面列出了android.os.Parcel#writeBlob ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/** @hide */
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(status);
dest.writeInt(soundModelHandle);
dest.writeByte((byte) (captureAvailable ? 1 : 0));
dest.writeInt(captureSession);
dest.writeInt(captureDelayMs);
dest.writeInt(capturePreambleMs);
dest.writeByte((byte) (triggerInData ? 1 : 0));
if (captureFormat != null) {
dest.writeByte((byte)1);
dest.writeInt(captureFormat.getSampleRate());
dest.writeInt(captureFormat.getEncoding());
dest.writeInt(captureFormat.getChannelMask());
} else {
dest.writeByte((byte)0);
}
dest.writeBlob(data);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(status);
dest.writeInt(soundModelHandle);
dest.writeByte((byte) (captureAvailable ? 1 : 0));
dest.writeInt(captureSession);
dest.writeInt(captureDelayMs);
dest.writeInt(capturePreambleMs);
dest.writeByte((byte) (triggerInData ? 1 : 0));
if (captureFormat != null) {
dest.writeByte((byte)1);
dest.writeInt(captureFormat.getSampleRate());
dest.writeInt(captureFormat.getEncoding());
dest.writeInt(captureFormat.getChannelMask());
} else {
dest.writeByte((byte)0);
}
dest.writeBlob(data);
dest.writeTypedArray(keyphraseExtras, flags);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeCharSequence(mPackageName);
dest.writeCharSequence(mName);
int numDiscoveredPrinters = mDiscoveredPrinters.size();
dest.writeInt(numDiscoveredPrinters);
for (InetAddress printer : mDiscoveredPrinters) {
dest.writeBlob(printer.getAddress());
}
dest.writeByte((byte) (mRecommendsMultiVendorService ? 1 : 0));
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(uuid.toString());
if (vendorUuid == null) {
dest.writeInt(-1);
} else {
dest.writeInt(vendorUuid.toString().length());
dest.writeString(vendorUuid.toString());
}
dest.writeBlob(data);
dest.writeTypedArray(keyphrases, flags);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(uuid.toString());
if (vendorUuid == null) {
dest.writeInt(-1);
} else {
dest.writeInt(vendorUuid.toString().length());
dest.writeString(vendorUuid.toString());
}
dest.writeBlob(data);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeByte((byte) (captureRequested ? 1 : 0));
dest.writeByte((byte) (allowMultipleTriggers ? 1 : 0));
dest.writeTypedArray(keyphrases, flags);
dest.writeBlob(data);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
Parcel data = Parcel.obtain();
data.writeInt(mEventCount);
data.writeInt(mIndex);
if (mEventCount > 0) {
data.writeStringArray(mStringPool);
if (mEventsToWrite != null) {
// Write out the events
Parcel p = Parcel.obtain();
try {
p.setDataPosition(0);
for (int i = 0; i < mEventCount; i++) {
final Event event = mEventsToWrite.get(i);
writeEventToParcel(event, p, flags);
}
final int listByteLength = p.dataPosition();
// Write the total length of the data.
data.writeInt(listByteLength);
// Write our current position into the data.
data.writeInt(0);
// Write the data.
data.appendFrom(p, 0, listByteLength);
} finally {
p.recycle();
}
} else if (mParcel != null) {
// Write the total length of the data.
data.writeInt(mParcel.dataSize());
// Write out current position into the data.
data.writeInt(mParcel.dataPosition());
// Write the data.
data.appendFrom(mParcel, 0, mParcel.dataSize());
} else {
throw new IllegalStateException(
"Either mParcel or mEventsToWrite must not be null");
}
}
// Data can be too large for a transact. Write the data as a Blob, which will be written to
// ashmem if too large.
dest.writeBlob(data.marshall());
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(status);
dest.writeInt(soundModelHandle);
dest.writeBlob(data);
}