Java Code Examples for android.os.Parcel.writeByteArray()

The following are Jave code examples for showing how to use writeByteArray() of the android.os.Parcel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: q-mail   File: OpenPgpDecryptionResult.java   Source Code and License Vote up 6 votes
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);
}
 
Example 2
Project: mesh-core-on-android   File: MeshDeviceInfo.java   Source Code and License Vote up 6 votes
@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);
  }
 
Example 3
Project: FuzzDroid   File: DexFileTransferTraceItem.java   Source Code and License Vote up 5 votes
@Override
public void writeToParcel(Parcel parcel, int arg1) {
	super.writeToParcel(parcel, arg1);
	parcel.writeString(fileName);
	
	parcel.writeInt(dexFile.length);
	parcel.writeByteArray(dexFile);
}
 
Example 4
Project: Exoplayer2Radio   File: GeobFrame.java   Source Code and License Vote up 5 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(mimeType);
  dest.writeString(filename);
  dest.writeString(description);
  dest.writeByteArray(data);
}
 
Example 5
Project: Phoenix-for-VK   File: VoiceMessage.java   Source Code and License Vote up 5 votes
@Override
public void writeToParcel(Parcel parcel, int i) {
    super.writeToParcel(parcel, i);
    parcel.writeInt(duration);
    parcel.writeByteArray(waveform);
    parcel.writeString(linkOgg);
    parcel.writeString(linkMp3);
}
 
Example 6
Project: okwallet   File: PaymentIntent.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 7
Project: WiFiSDCryptoLocker   File: User.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 8
Project: okwallet   File: PaymentIntent.java   Source Code and License Vote up 5 votes
@Override
public void writeToParcel(final Parcel dest, final int flags) {
    dest.writeSerializable(standard);

    dest.writeString(payeeName);
    dest.writeString(payeeVerifiedBy);

    if (outputs != null) {
        dest.writeInt(outputs.length);
        dest.writeTypedArray(outputs, 0);
    } else {
        dest.writeInt(0);
    }

    dest.writeString(memo);

    dest.writeString(paymentUrl);

    if (payeeData != null) {
        dest.writeInt(payeeData.length);
        dest.writeByteArray(payeeData);
    } else {
        dest.writeInt(0);
    }

    dest.writeString(paymentRequestUrl);

    if (paymentRequestHash != null) {
        dest.writeInt(paymentRequestHash.length);
        dest.writeByteArray(paymentRequestHash);
    } else {
        dest.writeInt(0);
    }
}
 
Example 9
Project: WearVibrationCenter   File: AlarmCommand.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 10
Project: nifi-android-s2s   File: ByteArrayDataPacket.java   Source Code and License Vote up 5 votes
@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);
    }
}
 
Example 11
Project: FireFiles   File: DurableUtils.java   Source Code and License Vote up 5 votes
public static <D extends Durable> void writeToParcel(Parcel parcel, D d) {
    try {
        parcel.writeByteArray(writeToArray(d));
    } catch (IOException e) {
        throw new BadParcelableException(e);
    }
}
 
Example 12
Project: mi-firma-android   File: Initiative.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 13
Project: anycall   File: Anycall.java   Source Code and License Vote up 5 votes
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();
}
 
Example 14
Project: Exoplayer2Radio   File: BinaryFrame.java   Source Code and License Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(id);
  dest.writeByteArray(data);
}
 
Example 15
Project: OpenYOLO-Android   File: HintRetrieveRequest.java   Source Code and License Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    byte[] protoBytes = toProtocolBuffer().toByteArray();
    dest.writeInt(protoBytes.length);
    dest.writeByteArray(protoBytes);
}
 
Example 16
Project: OpenYOLO-Android   File: CredentialRetrieveRequest.java   Source Code and License Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    byte[] protoBytes = toProtocolBuffer().toByteArray();
    dest.writeInt(protoBytes.length);
    dest.writeByteArray(protoBytes);
}
 
Example 17
Project: WearVibrationCenter   File: ReceivedNotification.java   Source Code and License Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(title);
    dest.writeString(description);
    dest.writeByteArray(imageDataPng);
}
 
Example 18
Project: OpenYOLO-Android   File: CredentialSaveRequest.java   Source Code and License Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    byte[] protoBytes = toProtocolBuffer().toByteArray();
    dest.writeInt(protoBytes.length);
    dest.writeByteArray(protoBytes);
}
 
Example 19
Project: OpenYOLO-Android   File: Credential.java   Source Code and License Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    byte[] encoded = toProtobuf().toByteArray();
    dest.writeInt(encoded.length);
    dest.writeByteArray(encoded);
}
 
Example 20
Project: Near   File: Host.java   Source Code and License Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(name);
    dest.writeInt(inetAddress.getAddress().length);
    dest.writeByteArray(inetAddress.getAddress());
}