Example usage for android.os Parcel writeByteArray

List of usage examples for android.os Parcel writeByteArray

Introduction

In this page you can find the example usage for android.os Parcel writeByteArray.

Prototype

public final void writeByteArray(byte[] b) 

Source Link

Document

Write a byte array into the parcel at the current #dataPosition , growing #dataCapacity if needed.

Usage

From source file:com.jungle.base.utils.MiscUtils.java

public static void writeBytesToParcel(Parcel dest, byte[] buff) {
    int len = buff != null ? buff.length : 0;
    dest.writeInt(len);/*from  w  ww  .  j  a  v  a2s .  co  m*/
    if (len > 0) {
        dest.writeByteArray(buff);
    }
}

From source file:com.codebutler.farebot.card.Card.java

public void writeToParcel(Parcel parcel, int flags) {
    parcel.writeInt(mTagId.length);/*from   www . j av  a2 s .c  om*/
    parcel.writeByteArray(mTagId);
    parcel.writeLong(mScannedAt.getTime());
}

From source file:edu.umich.flowfence.common.ParceledPayload.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    if (data.length < INLINE_SIZE) {
        dest.writeByteArray(data);
    } else {/*from  w ww  .ja v a2  s.  c  o m*/
        dest.writeByteArray(null);
        MemoryFile mf = null;
        try {
            mf = new MemoryFile("ParceledPayload", data.length);
            mf.writeBytes(data, 0, 0, data.length);
            FileDescriptor ashmemFd = mf.getFileDescriptor();
            dest.writeFileDescriptor(ashmemFd);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (mf != null) {
                mf.close();
            }
        }
    }
}

From source file:com.google.sample.beaconservice.Beacon.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(type);/*w w w  .  j a va2s. c o  m*/
    dest.writeByteArray(id);
    dest.writeString(status);
    if (placeId != null) {
        dest.writeInt(1);
        dest.writeString(placeId);
    } else {
        dest.writeInt(0);
    }
    if (latitude != null) {
        dest.writeInt(1);
        dest.writeDouble(latitude);
    } else {
        dest.writeInt(0);
    }
    if (longitude != null) {
        dest.writeInt(1);
        dest.writeDouble(longitude);
    } else {
        dest.writeInt(0);
    }
    if (expectedStability != null) {
        dest.writeInt(1);
        dest.writeString(expectedStability);
    } else {
        dest.writeInt(0);
    }
    if (description != null) {
        dest.writeInt(1);
        dest.writeString(description);
    } else {
        dest.writeInt(0);
    }
}

From source file:com.codebutler.farebot.card.desfire.DesfireFileSettings.java

public void writeToParcel(Parcel parcel, int flags) {
    parcel.writeByte(fileType);/*from w w  w.ja v a  2s .  com*/
    parcel.writeByte(commSetting);
    parcel.writeInt(accessRights.length);
    parcel.writeByteArray(accessRights);
}

From source file:com.codebutler.farebot.card.desfire.DesfireFile.java

public void writeToParcel(Parcel parcel, int flags) {
    parcel.writeInt(mId);/*from   w w  w.  j ava 2 s .co  m*/
    if (this instanceof InvalidDesfireFile) {
        parcel.writeInt(1);
        parcel.writeString(((InvalidDesfireFile) this).getErrorMessage());
    } else {
        parcel.writeInt(0);
        parcel.writeParcelable(mSettings, 0);
        parcel.writeInt(mData.length);
        parcel.writeByteArray(mData);
    }
}

From source file:com.v2soft.dnremote.dao.Server.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(mId.toString());//w w  w.j a va2 s  .  c o m
    dest.writeString(mName);
    dest.writeString(mServer);
    dest.writeInt(mPort);
    dest.writeByte((byte) (mRelative ? 1 : 0));
    if (mIPAddr != null) {
        dest.writeInt(mIPAddr.length);
        dest.writeByteArray(mIPAddr);
    } else {
        dest.writeInt(0);
    }
}

From source file:de.schildbach.wallet.data.PaymentIntent.java

@Override
public void writeToParcel(final Parcel dest, final int flags) {
    dest.writeSerializable(standard);//from   w w w .  ja  v  a2  s . com

    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);
    }
}