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

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

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

Parcel.readInt介绍

[英]Read an integer value from the parcel at the current dataPosition().
[中]从当前dataPosition()处的地块读取整数值。

代码示例

代码示例来源:origin: airbnb/lottie-android

private SavedState(Parcel in) {
 super(in);
 animationName = in.readString();
 progress = in.readFloat();
 isAnimating = in.readInt() == 1;
 imageAssetsFolder = in.readString();
 repeatMode = in.readInt();
 repeatCount = in.readInt();
}

代码示例来源:origin: stackoverflow.com

out.writeInt(mData);
mData = in.readInt();

代码示例来源:origin: smuyyh/BookReader

public SavedState(Parcel source) {
  super(source);
  tagCount = source.readInt();
  tags = new String[tagCount];
  source.readStringArray(tags);
  checkedPosition = source.readInt();
  input = source.readString();
}

代码示例来源:origin: stackoverflow.com

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeParcelable(otherClass, flags);
  dest.writeString(name);
  dest.writeInt(id);
}

private MyClass(Parcel in) {
  otherClass = (OtherClass) in.readParcelable(OtherClass.class.getClassLoader());
  name = in.readString();
  id = in.readInt();
}

代码示例来源:origin: android10/Android-CleanArchitecture

private SavedState(Parcel in) {
 super(in);
 this.imagePlaceHolderResId = in.readInt();
 this.imageUrl = in.readString();
}

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

@Test
public void testWriteThenReadIsOkIfNotAtEnd() {
 parcel.writeInt(1);
 parcel.writeInt(2);
 parcel.writeInt(3);
 parcel.writeInt(4);
 parcel.setDataPosition(0);
 parcel.writeInt(5);
 assertThat(parcel.readInt()).isEqualTo(2);
 assertThat(parcel.readInt()).isEqualTo(3);
 assertThat(parcel.readInt()).isEqualTo(4);
 // This should succeed: while this is weird, the caller didn't clearly forget to reset the data
 // position, and is reading past the end of the parcel in a normal way.
 assertThat(parcel.readInt()).isEqualTo(0);
}

代码示例来源:origin: stackoverflow.com

public void writeToParcel(Parcel out, int flags) {
  out.writeString(_mac);
  out.writeString(_pan);
  out.writeInt(_band);
  out.writeSerializable(_lqis);
  out.writeTypedList(_devices);
}

private ZigBeeNetwork(Parcel in) {
  _mac = in.readString();
  _pan = in.readString();
  _band = in.readInt();
  _lqis = (ArrayList<Integer>) in.readSerializable();
  in.readTypedList(_devices, ZigBeeDev.CREATOR);
}

代码示例来源:origin: android-hacker/VirtualXposed

JobId(Parcel in) {
  this.vuid = in.readInt();
  this.packageName = in.readString();
  this.clientJobId = in.readInt();
}

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

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

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

@Test
public void testReadWriteStringInt() {
 for (int i = 0; i < 10; ++i) {
  parcel.writeString(Integer.toString(i));
  parcel.writeInt(i);
 }
 parcel.setDataPosition(0);
 for (int i = 0; i < 10; ++i) {
  assertThat(parcel.readString()).isEqualTo(Integer.toString(i));
  assertThat(parcel.readInt()).isEqualTo(i);
 }
 // now try to read past the number of items written and see what happens
 assertThat(parcel.readString()).isNull();
 assertThat(parcel.readInt()).isEqualTo(0);
}

代码示例来源:origin: seven332/EhViewer

protected GalleryPreview(Parcel in) {
  this.imageUrl = in.readString();
  this.pageUrl = in.readString();
  this.position = in.readInt();
  this.offsetX = in.readInt();
  this.offsetY = in.readInt();
  this.clipWidth = in.readInt();
  this.clipHeight = in.readInt();
}

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

@Test
public void testReadWithoutRewinding() {
 parcel.writeInt(123);
 try {
  parcel.readInt();
  fail("should have thrown");
 } catch (UnreliableBehaviorError e) {
  assertThat(e).hasMessage("Did you forget to setDataPosition(0) before reading the parcel?");
 }
}

代码示例来源:origin: android-hacker/VirtualXposed

private VUserInfo(Parcel source) {
    id = source.readInt();
    name = source.readString();
    iconPath = source.readString();
    flags = source.readInt();
    serialNumber = source.readInt();
    creationTime = source.readLong();
    lastLoggedInTime = source.readLong();
    partial = source.readInt() != 0;
    profileGroupId = source.readInt();
  }
}

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

@Test
public void testReadWriteSingleInt() {
 int val = 5;
 parcel.writeInt(val);
 parcel.setDataPosition(0);
 assertThat(parcel.readInt()).isEqualTo(val);
}

代码示例来源:origin: rockerhieu/emojicon

public Emojicon(Parcel in) {
  this.icon = in.readInt();
  this.value = (char) in.readInt();
  this.emoji = in.readString();
}

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

@Test
public void testDataPositionAfterSomeReads() {
 parcel.writeInt(1);
 parcel.writeFloat(5);
 parcel.writeDouble(37);
 parcel.setDataPosition(0);
 parcel.readInt();
 assertThat(parcel.dataPosition()).isEqualTo(4);
 parcel.readFloat();
 assertThat(parcel.dataPosition()).isEqualTo(8);
 parcel.readDouble();
 assertThat(parcel.dataPosition()).isEqualTo(16);
}

代码示例来源:origin: aurelhubert/ahbottomnavigation

private AHNotification(Parcel in) {
  text = in.readString();
  textColor = in.readInt();
  backgroundColor = in.readInt();
}

代码示例来源:origin: seven332/EhViewer

protected FavListUrlBuilder(Parcel in) {
  this.mIndex = in.readInt();
  this.mKeyword = in.readString();
  this.mFavCat = in.readInt();
}

代码示例来源:origin: android-hacker/VirtualXposed

protected BadgerInfo(Parcel in) {
  userId = in.readInt();
  packageName = in.readString();
  badgerCount = in.readInt();
  className = in.readString();
}

代码示例来源:origin: googlesamples/easypermissions

private AppSettingsDialog(Parcel in) {
  mThemeResId = in.readInt();
  mRationale = in.readString();
  mTitle = in.readString();
  mPositiveButtonText = in.readString();
  mNegativeButtonText = in.readString();
  mRequestCode = in.readInt();
  mIntentFlags = in.readInt();
}

相关文章

Parcel类方法