android.os.Parcel.writeLong()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(202)

本文整理了Java中android.os.Parcel.writeLong()方法的一些代码示例,展示了Parcel.writeLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.writeLong()方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:writeLong

Parcel.writeLong介绍

[英]Write a long integer value into the parcel at the current dataPosition(), growing dataCapacity() if needed.
[中]在当前dataPosition()处向包裹中写入一个长整数值,必要时增加dataCapacity()。

代码示例

代码示例来源:origin: google/ExoPlayer

@Override
public void writeToParcel(Parcel dest, int flags) {
 dest.writeLong(ptsTime);
 dest.writeLong(playbackPositionUs);
}

代码示例来源:origin: lingochamp/FileDownloader

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeLong(this.v1);
  dest.writeLong(this.v2);
  dest.writeLong(this.v3);
}

代码示例来源:origin: google/ExoPlayer

public void writeToParcel(Parcel dest) {
 dest.writeInt(componentTag);
 dest.writeLong(componentSplicePts);
 dest.writeLong(componentSplicePlaybackPositionUs);
}

代码示例来源:origin: zhihu/Matisse

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeLong(id);
  dest.writeString(mimeType);
  dest.writeParcelable(uri, 0);
  dest.writeLong(size);
  dest.writeLong(duration);
}

代码示例来源:origin: google/ExoPlayer

private void writeToParcel(Parcel dest) {
 dest.writeInt(componentTag);
 dest.writeLong(utcSpliceTime);
}

代码示例来源:origin: bumptech/glide

@Override
public void writeToParcel(Parcel parcel, int i) {
 parcel.writeLong(rowId);
 parcel.writeString(uri.toString());
 parcel.writeString(mimeType);
 parcel.writeLong(dateTaken);
 parcel.writeLong(dateModified);
 parcel.writeInt(orientation);
 parcel.writeString(type.name());
}

代码示例来源:origin: google/ExoPlayer

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

代码示例来源:origin: google/ExoPlayer

@Override
public void writeToParcel(Parcel dest, int flags) {
 dest.writeString(chapterId);
 dest.writeInt(startTimeMs);
 dest.writeInt(endTimeMs);
 dest.writeLong(startOffset);
 dest.writeLong(endOffset);
 dest.writeInt(subFrames.length);
 for (Id3Frame subFrame : subFrames) {
  dest.writeParcelable(subFrame, 0);
 }
}

代码示例来源:origin: lingochamp/FileDownloader

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(this.url);
  dest.writeString(this.path);
  dest.writeLong(this.totalBytes);
}

代码示例来源:origin: lingochamp/FileDownloader

@Override
public void writeToParcel(Parcel dest, int flags) {
  super.writeToParcel(dest, flags);
  dest.writeLong(this.sofarBytes);
  dest.writeLong(this.totalBytes);
}

代码示例来源:origin: google/ExoPlayer

@Override
public void writeToParcel(Parcel dest, int flags) {
 dest.writeLong(ptsAdjustment);
 dest.writeLong(identifier);
 dest.writeInt(commandBytes.length);
 dest.writeByteArray(commandBytes);
}

代码示例来源:origin: google/ExoPlayer

@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);
 dest.writeByte((byte) (requiresSecureDecryption ? 1 : 0));
}

代码示例来源:origin: lingochamp/FileDownloader

@Override
public void writeToParcel(Parcel dest, int flags) {
  super.writeToParcel(dest, flags);
  dest.writeLong(this.sofarBytes);
}

代码示例来源:origin: lingochamp/FileDownloader

@Override
public void writeToParcel(Parcel dest, int flags) {
  super.writeToParcel(dest, flags);
  dest.writeByte(reusedDownloadedFile ? (byte) 1 : (byte) 0);
  dest.writeLong(this.totalBytes);
}

代码示例来源:origin: lingochamp/FileDownloader

@Override
public void writeToParcel(Parcel dest, int flags) {
  super.writeToParcel(dest, flags);
  dest.writeLong(this.sofarBytes);
  dest.writeSerializable(this.throwable);
}

代码示例来源:origin: robolectric/robolectric

public boolean writeToParcel(Parcel parcel) {
 parcel.writeLong(bits.getValue());
 int count = bits.count();
 for (int i = 0; i < count; i++) {
  parcel.writeFloat(values[i]);
 }
 return true;
}

代码示例来源:origin: robolectric/robolectric

@Test(expected = RuntimeException.class)
public void testWriteLongReadString() {
 long val = 9;
 parcel.writeLong(val);
 parcel.setDataPosition(0);
 parcel.readString();
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testReadWriteSingleLong() {
 long val = 5;
 parcel.writeLong(val);
 parcel.setDataPosition(0);
 assertThat(parcel.readLong()).isEqualTo(val);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testReadWriteMultipleLongs() {
 for (long i = 0; i < 10; ++i) {
  parcel.writeLong(i);
 }
 parcel.setDataPosition(0);
 for (long i = 0; i < 10; ++i) {
  assertThat(parcel.readLong()).isEqualTo(i);
 }
 // now try to read past the number of items written and see what happens
 assertThat(parcel.readLong()).isEqualTo(0L);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testByteArrayToleratesZeroes() {
 parcel.writeInt(19); // Length
 parcel.writeInt(0); // These are zero
 parcel.writeLong(0); // This is zero
 parcel.writeFloat(0.0f); // This is zero
 parcel.writeByteArray(new byte[0]); // This is also zero
 assertThat(parcel.dataSize()).isEqualTo(24);
 parcel.setDataPosition(0);
 assertThat(parcel.createByteArray()).isEqualTo(new byte[19]);
}

相关文章

Parcel类方法