@Test public void testParcelable() { ArrayList<StreamKey> streamKeys = new ArrayList<>(); streamKeys.add(new StreamKey(1, 2, 3)); streamKeys.add(new StreamKey(4, 5, 6)); DownloadRequest requestToParcel = new DownloadRequest( "id", "type", Uri.parse("https: streamKeys, "key", new byte[] {1, 2, 3, 4, 5}); Parcel parcel = Parcel.obtain(); requestToParcel.writeToParcel(parcel, 0); parcel.setDataPosition(0); DownloadRequest requestFromParcel = DownloadRequest.CREATOR.createFromParcel(parcel); assertThat(requestFromParcel).isEqualTo(requestToParcel); parcel.recycle(); }
@Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(type); dest.writeString(uri.toString()); dest.writeInt(streamKeys.size()); for (int i = 0; i < streamKeys.size(); i++) { dest.writeParcelable(streamKeys.get(i), 0); } dest.writeString(customCacheKey); dest.writeInt(data.length); dest.writeByteArray(data); }
DownloadRequest implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(type); dest.writeString(uri.toString()); dest.writeInt(streamKeys.size()); for (int i = 0; i < streamKeys.size(); i++) { dest.writeParcelable(streamKeys.get(i), 0); } dest.writeString(customCacheKey); dest.writeInt(data.length); dest.writeByteArray(data); } }
DownloadRequest implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(type); dest.writeString(uri.toString()); dest.writeInt(streamKeys.size()); for (int i = 0; i < streamKeys.size(); i++) { dest.writeParcelable(streamKeys.get(i), 0); } dest.writeString(customCacheKey); dest.writeInt(data.length); dest.writeByteArray(data); } DownloadRequest(
      String id,
      String type,
      Uri uri,
      List<StreamKey> streamKeys,
      @Nullable String customCacheKey,
      @Nullable byte[] data);   DownloadRequest(Parcel in); }
DownloadRequest implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(type); dest.writeString(uri.toString()); dest.writeInt(streamKeys.size()); for (int i = 0; i < streamKeys.size(); i++) { dest.writeParcelable(streamKeys.get(i), 0); } dest.writeString(customCacheKey); dest.writeInt(data.length); dest.writeByteArray(data); } DownloadRequest(
      String id,
      String type,
      Uri uri,
      List<StreamKey> streamKeys,
      @Nullable String customCacheKey,
      @Nullable byte[] data);   DownloadRequest(Parcel in); DownloadRequest copyWithId(String id); DownloadRequest copyWithMergedRequest(DownloadRequest newRequest); @Override String toString(); @Override boolean equals(@Nullable Object o); @Override final int hashCode(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); }
DownloadRequest implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(type); dest.writeString(uri.toString()); dest.writeInt(streamKeys.size()); for (int i = 0; i < streamKeys.size(); i++) { dest.writeParcelable(streamKeys.get(i), 0); } dest.writeString(customCacheKey); dest.writeInt(data.length); dest.writeByteArray(data); } DownloadRequest(
      String id,
      String type,
      Uri uri,
      List<StreamKey> streamKeys,
      @Nullable String customCacheKey,
      @Nullable byte[] data);   DownloadRequest(Parcel in); DownloadRequest copyWithId(String id); DownloadRequest copyWithMergedRequest(DownloadRequest newRequest); @Override String toString(); @Override boolean equals(@Nullable Object o); @Override final int hashCode(); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); static final String TYPE_PROGRESSIVE; static final String TYPE_DASH; static final String TYPE_HLS; static final String TYPE_SS; final String id; final String type; final Uri uri; final List<StreamKey> streamKeys; @Nullable final String customCacheKey; final byte[] data; static final Parcelable.Creator<DownloadRequest> CREATOR; }