本文整理汇总了Java中android.os.Parcel.writeByteArray方法的典型用法代码示例。如果您正苦于以下问题:Java Parcel.writeByteArray方法的具体用法?Java Parcel.writeByteArray怎么用?Java Parcel.writeByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Parcel
的用法示例。
在下文中一共展示了Parcel.writeByteArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
public void writeToParcel(Parcel dest, int flags) {
/**
* NOTE: When adding fields in the process of updating this API, make sure to bump
* {@link #PARCELABLE_VERSION}.
*/
dest.writeInt(PARCELABLE_VERSION);
// Inject a placeholder that will store the parcel size from this point on
// (not including the size itself).
int sizePosition = dest.dataPosition();
dest.writeInt(0);
int startPosition = dest.dataPosition();
// version 1
dest.writeInt(result);
// version 2
dest.writeByteArray(sessionKey);
dest.writeByteArray(decryptedSessionKey);
// Go back and write the size
int parcelableSize = dest.dataPosition() - startPosition;
dest.setDataPosition(sizePosition);
dest.writeInt(parcelableSize);
dest.setDataPosition(startPosition + parcelableSize);
}
示例2: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel parcel, int flags) {
byte[] tmp = new byte[2];
tmp[0] = (byte)(mCid & 0xFF);
tmp[1] = (byte)((mCid >> 8) & 0xFF);
parcel.writeByteArray(tmp);
tmp[0] = (byte)(mVid & 0xFF);
tmp[1] = (byte)((mVid >> 8) & 0xFF);
parcel.writeByteArray(tmp);
tmp[0] = (byte)(mPid & 0xFF);
tmp[1] = (byte)((mPid >> 8) & 0xFF);
parcel.writeByteArray(tmp);
}
示例3: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel parcel, int arg1) {
super.writeToParcel(parcel, arg1);
parcel.writeString(fileName);
parcel.writeInt(dexFile.length);
parcel.writeByteArray(dexFile);
}
示例4: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mimeType);
dest.writeString(filename);
dest.writeString(description);
dest.writeByteArray(data);
}
示例5: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeInt(duration);
parcel.writeByteArray(waveform);
parcel.writeString(linkOgg);
parcel.writeString(linkMp3);
}
示例6: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(final Parcel dest, final int flags) {
dest.writeSerializable(amount);
final byte[] program = script.getProgram();
dest.writeInt(program.length);
dest.writeByteArray(program);
}
示例7: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeLong(this.id);
parcel.writeString(this.username);
parcel.writeString(this.password);
parcel.writeInt(this.salt.length);
parcel.writeByteArray(this.salt);
parcel.writeInt(this.cryptoKey.length);
parcel.writeByteArray(this.cryptoKey);
parcel.writeInt(this.cryptoKey_iv.length);
parcel.writeByteArray(this.cryptoKey_iv);
parcel.writeLong(this.createdAt.getTime());
parcel.writeString(this.passwordNotHashed);
}
示例8: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.text);
dest.writeLongArray(this.vibrationPattern);
dest.writeByteArray(this.backgroundBitmap);
dest.writeByteArray(this.icon);
dest.writeInt(this.snoozeDuration);
dest.writeByte(this.doNotVibrateInTheater ? (byte) 1 : (byte) 0);
dest.writeByte(this.doNotVibrateOnCharger ? (byte) 1 : (byte) 0);
}
示例9: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(attributes.size());
for (Map.Entry<String, String> entry : attributes.entrySet()) {
dest.writeString(entry.getKey());
dest.writeString(entry.getValue());
}
dest.writeInt(data.length);
if (data.length > 0) {
dest.writeByteArray(data);
}
}
示例10: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
public static <D extends Durable> void writeToParcel(Parcel parcel, D d) {
try {
parcel.writeByteArray(writeToArray(d));
} catch (IOException e) {
throw new BadParcelableException(e);
}
}
示例11: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(this.title);
parcel.writeString(this.promoter);
parcel.writeInt(this.banner.length);
parcel.writeByteArray(this.banner);
parcel.writeSerializable(this.initDate);
parcel.writeSerializable(this.endDate);
parcel.writeInt(this.numRequiredSignatures);
parcel.writeInt(this.id);
parcel.writeString(this.promoterUrl.toString());
parcel.writeInt(this.numActualSignatures);
parcel.writeString(this.howtoSolveAsHtml);
}
示例12: callMethod
import android.os.Parcel; //导入方法依赖的package包/类
public void callMethod(final String className, final String serviceName,
final String methodName, final Object... paramsAndListener) {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(className);
for (int i = 0; i < paramsAndListener.length - 1; i++) {
Object p = paramsAndListener[i];
if (p instanceof Byte)
data.writeByte((Byte) p);
else if (p instanceof Integer)
data.writeInt((Integer) p);
else if (p instanceof Long)
data.writeLong((Long) p);
else if (p instanceof String)
data.writeString((String) p);
else if (p instanceof Bundle)
data.writeBundle((Bundle) p);
else if (p instanceof Float)
data.writeFloat((Float) p);
else if (p instanceof FileDescriptor)
data.writeFileDescriptor((FileDescriptor) p);
else if (p instanceof List)
data.writeList((List) p);
else if (p instanceof Exception)
data.writeException((Exception) p);
else if (p instanceof IBinder)
data.writeStrongBinder((IBinder) p);
else if (p instanceof Double)
data.writeDouble((Double) p);
else if (p instanceof Map)
data.writeMap((Map) p);
else if (p instanceof boolean[])
data.writeBooleanArray((boolean[]) p);
else if (p instanceof byte[])
data.writeByteArray((byte[]) p);
else if (p instanceof char[])
data.writeCharArray((char[]) p);
else if (p instanceof int[])
data.writeIntArray((int[]) p);
else if (p instanceof IBinder[])
data.writeBinderArray((IBinder[]) p);
else if (p instanceof double[])
data.writeDoubleArray((double[]) p);
else if (p instanceof Object[])
data.writeArray((Object[]) p);
else data.writeValue(p);
}
Object lastParam = paramsAndListener[paramsAndListener.length - 1];
CallMethodResultListener listener = lastParam == null ? null :
(CallMethodResultListener) lastParam;
callMethod(className, serviceName, methodName, data, listener);
data.recycle();
}
示例13: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeByteArray(data);
}
示例14: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
byte[] protoBytes = toProtocolBuffer().toByteArray();
dest.writeInt(protoBytes.length);
dest.writeByteArray(protoBytes);
}
示例15: writeToParcel
import android.os.Parcel; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(title);
dest.writeString(description);
dest.writeByteArray(imageDataPng);
}