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

The following examples show how to use android.os.Parcel#writeByteArray() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
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
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(uuid);
    dest.writeByte((byte) (isConfigured ? 1 : 0));
    dest.writeString(nodeName);
    dest.writeList(mAddedNetKeys);
    dest.writeByteArray(mFlags);
    dest.writeInt(unicastAddress);
    dest.writeByteArray(deviceKey);
    dest.writeValue(ttl);
    dest.writeInt(sequenceNumber);
    dest.writeValue(companyIdentifier);
    dest.writeValue(productIdentifier);
    dest.writeValue(versionIdentifier);
    dest.writeValue(crpl);
    dest.writeValue(nodeFeatures);
    dest.writeMap(mElements);
    dest.writeList(mAddedAppKeys);
    dest.writeLong(mTimeStampInMillis);
    dest.writeParcelable(mSeqAuth, flags);
    dest.writeValue(secureNetworkBeaconSupported);
    dest.writeParcelable(networkTransmitSettings, flags);
    dest.writeParcelable(relaySettings, flags);
    dest.writeInt((blackListed ? 1 : 0));
}
 
Example 3
Source Project: TvAppRepo   File: AdvancedOptions.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(mCustomLabel);
    dest.writeString(mCategory);
    dest.writeString(mIconUrl);
    dest.writeString(mBannerUrl);
    dest.writeByte((byte) (mUnique ? 1 : 0));
    dest.writeString(mIntentUri);
    if (mIconData == null) {
        mIconData = new byte[0];
    }
    if (mBannerData == null) {
        mBannerData = new byte[0];
    }
    dest.writeInt(mIconData.length);
    dest.writeByteArray(mIconData);
    dest.writeInt(mBannerData.length);
    dest.writeByteArray(mBannerData);
}
 
Example 4
Source Project: android_9.0.0_r45   File: ScanResult.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    if (mDevice != null) {
        dest.writeInt(1);
        mDevice.writeToParcel(dest, flags);
    } else {
        dest.writeInt(0);
    }
    if (mScanRecord != null) {
        dest.writeInt(1);
        dest.writeByteArray(mScanRecord.getBytes());
    } else {
        dest.writeInt(0);
    }
    dest.writeInt(mRssi);
    dest.writeLong(mTimestampNanos);
    dest.writeInt(mEventType);
    dest.writeInt(mPrimaryPhy);
    dest.writeInt(mSecondaryPhy);
    dest.writeInt(mAdvertisingSid);
    dest.writeInt(mTxPower);
    dest.writeInt(mPeriodicAdvertisingInterval);
}
 
Example 5
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(schemeIdUri);
  dest.writeString(value);
  dest.writeLong(presentationTimeUs);
  dest.writeLong(durationMs);
  dest.writeLong(id);
  dest.writeByteArray(messageData);
}
 
Example 6
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.writeByteArray(keyData);
    if (effectiveDate != null) {
        dest.writeInt(1);
        dest.writeLong(effectiveDate.getTime());
    } else {
        dest.writeInt(0);
    }

    dest.writeInt(preferEncrypt.ordinal());

    // Go back and write the size
    int parcelableSize = dest.dataPosition() - startPosition;
    dest.setDataPosition(sizePosition);
    dest.writeInt(parcelableSize);
    dest.setDataPosition(startPosition + parcelableSize);
}
 
Example 7
Source Project: MediaSDK   File: DrmInitData.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeLong(uuid.getMostSignificantBits());
  dest.writeLong(uuid.getLeastSignificantBits());
  dest.writeString(licenseServerUrl);
  dest.writeString(mimeType);
  dest.writeByteArray(data);
}
 
Example 8
Source Project: AutoTest   File: NetworkResponseEntity.java    License: MIT License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(this.message);
    dest.writeString(this.url);
    dest.writeInt(this.code);
    dest.writeByte(this.isRedirect ? (byte) 1 : (byte) 0);
    dest.writeByte(this.isSuccessful ? (byte) 1 : (byte) 0);
    dest.writeByte(this.isHttps ? (byte) 1 : (byte) 0);
    dest.writeString(this.protocol);
    dest.writeString(this.method);
    dest.writeString(this.headers);
    dest.writeByteArray(this.content);
}
 
Example 9
Source Project: MediaSDK   File: EventMessage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(schemeIdUri);
  dest.writeString(value);
  dest.writeLong(durationMs);
  dest.writeLong(id);
  dest.writeByteArray(messageData);
}
 
Example 10
Source Project: MediaSDK   File: PictureFrame.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeInt(pictureType);
  dest.writeString(mimeType);
  dest.writeString(description);
  dest.writeInt(width);
  dest.writeInt(height);
  dest.writeInt(depth);
  dest.writeInt(colors);
  dest.writeByteArray(pictureData);
}
 
Example 11
private void writeNodeContents(Parcel dest) {
    dest.writeLong(mId);
    dest.writeString(mName);
    dest.writeString(mUrl);
    dest.writeInt(mType.ordinal());
    dest.writeByteArray(mFavicon);
    dest.writeByteArray(mThumbnail);
    dest.writeLong(mParent != null ? mParent.mId : INVALID_BOOKMARK_ID);
}
 
Example 12
Source Project: OpenYOLO-Android   File: QueryResponse.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(responderPackage);
    dest.writeLong(responseId);
    dest.writeInt(responseMessage != null ? 1 : 0);

    if (responseMessage != null) {
        dest.writeInt(responseMessage.length);
        dest.writeByteArray(responseMessage);
    }
}
 
Example 13
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(mimeType);
  dest.writeString(filename);
  dest.writeString(description);
  dest.writeByteArray(data);
}
 
Example 14
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(key);
  dest.writeInt(value.length);
  dest.writeByteArray(value);
  dest.writeInt(localeIndicator);
  dest.writeInt(typeIndicator);
}
 
Example 15
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeInt(colorSpace);
  dest.writeInt(colorRange);
  dest.writeInt(colorTransfer);
  Util.writeBoolean(dest, hdrStaticInfo != null);
  if (hdrStaticInfo != null) {
    dest.writeByteArray(hdrStaticInfo);
  }
}
 
Example 16
@Override
public void writeToParcel(Parcel out, int flags) {
    out.writeInt(resultCode);
    out.writeStrongBinder(token);
    out.writeLong(operationHandle);
    out.writeInt(inputConsumed);
    out.writeByteArray(output);
    outParams.writeToParcel(out, flags);
}
 
Example 17
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(schemeIdUri);
  dest.writeString(value);
  dest.writeLong(durationMs);
  dest.writeLong(id);
  dest.writeByteArray(messageData);
}
 
Example 18
Source Project: android-nfc-lib   File: TestUtilities.java    License: MIT License 5 votes vote down vote up
public Tag mockTag(String technology) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
    // For future reference

    // Parameters :
    byte[] b = {0x8};
    String ndefClass = "android.nfc.tech.Ndef";

    // FieldName which marks the capacity of the tag
    String extraNdefMaxlength = (String) Class.forName(ndefClass).getField("EXTRA_NDEF_MAXLENGTH").get(null);

    // FieldName which marks the tags writability
    String cardWritableStateField = (String) Class.forName(ndefClass).getField("EXTRA_NDEF_CARDSTATE").get(null);

    // Field to mark tag R/W
    int cardWritable = Class.forName(ndefClass).getField("NDEF_MODE_READ_WRITE").getInt(null);

    Bundle techExtras = new Bundle();

    techExtras.putInt(extraNdefMaxlength, 2048);
    techExtras.putInt(cardWritableStateField, cardWritable);
    Bundle[] extras = {techExtras};
    int[] technologies = {TagTechnology.class.getField(technology.toUpperCase()).getInt(null)}; //https://android.googlesource.com/platform/frameworks/base.git/+/android-4.3_r2/core/java/android/nfc/tech/TagTechnology.java


    // https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/nfc/Tag.java :376
    Parcel parcel = Parcel.obtain();

    parcel.writeByteArray(b); //Sets the ID
    parcel.writeIntArray(technologies); // Sets the technology to NDEF
    parcel.writeArray(extras); // Needed to set properties for NDEF tag
    parcel.writeInt(1); // Service handle
    parcel.writeInt(1); // Indicating a mock

    return Tag.CREATOR.createFromParcel(parcel);
}
 
Example 19
Source Project: MediaSDK   File: BinaryFrame.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(id);
  dest.writeByteArray(data);
}
 
Example 20
Source Project: android_9.0.0_r45   File: SecurityLog.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeLong(mId);
    dest.writeByteArray(mEvent.getBytes());
}