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

The following examples show how to use android.os.Parcel#writeByteArray() . 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
Source File: OpenPgpDecryptionResult.java    From openpgp-api with Apache License 2.0 6 votes vote down vote up
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
Source File: ProvisionedMeshNode.java    From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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 File: ScanResult.java    From android_9.0.0_r45 with 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 4
Source File: AdvancedOptions.java    From TvAppRepo with 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 5
Source File: EventMessage.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@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
Source File: TestUtilities.java    From android-nfc-lib with 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 7
Source File: EventMessage.java    From Telegram with GNU General Public License v2.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 8
Source File: OperationResult.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@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 9
Source File: ColorInfo.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@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 10
Source File: MdtaMetadataEntry.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@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 11
Source File: GeobFrame.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(mimeType);
  dest.writeString(filename);
  dest.writeString(description);
  dest.writeByteArray(data);
}
 
Example 12
Source File: QueryResponse.java    From OpenYOLO-Android with 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
Source File: ChromeBrowserProvider.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
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 14
Source File: PictureFrame.java    From MediaSDK with 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 15
Source File: EventMessage.java    From MediaSDK with 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 16
Source File: NetworkResponseEntity.java    From AutoTest with 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 17
Source File: DrmInitData.java    From MediaSDK with 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 18
Source File: AutocryptPeerUpdate.java    From FairEmail with GNU General Public License v3.0 5 votes vote down vote up
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 19
Source File: BinaryFrame.java    From MediaSDK with 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 File: SecurityLog.java    From android_9.0.0_r45 with 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());
}