本文整理了Java中android.os.Parcel.writeString()
方法的一些代码示例,展示了Parcel.writeString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.writeString()
方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:writeString
[英]Write a string value into the parcel at the current dataPosition(), growing dataCapacity() if needed.
[中]在当前dataPosition()处向包裹中写入字符串值,必要时增加dataCapacity()。
代码示例来源:origin: aa112901/remusic
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.album_id);
dest.writeString(this.author);
dest.writeInt(this.hot);
dest.writeString(this.title);
dest.writeString(this.artist_id);
dest.writeString(this.all_artist_id);
dest.writeString(this.company);
dest.writeString(this.publishtime);
dest.writeString(this.album_desc);
dest.writeString(this.pic_small);
}
代码示例来源:origin: bluelinelabs/Conductor
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(instanceId);
out.writeStringArray(permissions);
out.writeInt(requestCode);
}
代码示例来源: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: robolectric/robolectric
@Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
this.code = code;
this.data = data;
this.reply = reply;
this.flags = flags;
String string = data.readString();
reply.writeNoException();
reply.writeString(string);
return true;
}
}
代码示例来源:origin: aa112901/remusic
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.artist_id);
dest.writeString(this.author);
dest.writeString(this.ting_uid);
dest.writeString(this.avatar_middle);
dest.writeInt(this.album_num);
dest.writeInt(this.song_num);
dest.writeString(this.country);
dest.writeString(this.artist_desc);
dest.writeString(this.artist_source);
}
代码示例来源:origin: stackoverflow.com
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeInt(numOfSeason);
dest.writeInt(numOfEpisode);
}
private void readFromParcel(Parcel in) {
name = in.readString();
numOfSeason = in.readInt();
numOfEpisode = in.readInt();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testSetDataPositionToEmptyString() {
parcel.writeString("");
parcel.setDataPosition(parcel.dataPosition());
parcel.writeString("something else");
parcel.setDataPosition(0);
assertThat(parcel.readString()).isEmpty();
}
代码示例来源:origin: google/ExoPlayer
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(elementId);
dest.writeByte((byte) (isRoot ? 1 : 0));
dest.writeByte((byte) (isOrdered ? 1 : 0));
dest.writeStringArray(children);
dest.writeInt(subFrames.length);
for (Id3Frame subFrame : subFrames) {
dest.writeParcelable(subFrame, 0);
}
}
代码示例来源:origin: Justson/AgentWeb
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mId);
dest.writeString(mContentPath);
dest.writeString(mFileBase64);
}
代码示例来源: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: robolectric/robolectric
@Test
public void testReadWriteStringLong() {
for (long i = 0; i < 10; ++i) {
parcel.writeString(Long.toString(i));
parcel.writeLong(i);
}
parcel.setDataPosition(0);
for (long i = 0; i < 10; ++i) {
assertThat(parcel.readString()).isEqualTo(Long.toString(i));
assertThat(parcel.readLong()).isEqualTo(i);
}
// now try to read past the number of items written and see what happens
assertThat(parcel.readString()).isNull();
assertThat(parcel.readLong()).isEqualTo(0L);
}
代码示例来源:origin: smuyyh/BookReader
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
tagCount = tags.length;
dest.writeInt(tagCount);
dest.writeStringArray(tags);
dest.writeInt(checkedPosition);
dest.writeString(input);
}
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.packageName);
dest.writeString(this.apkPath);
dest.writeString(this.libPath);
dest.writeByte(this.dependSystem ? (byte) 1 : (byte) 0);
dest.writeInt(this.appId);
}
代码示例来源: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: robolectric/robolectric
@Test
public void testReadWriteMultipleStrings() {
for (int i = 0; i < 10; ++i) {
parcel.writeString(Integer.toString(i));
assertInvariants();
}
parcel.setDataPosition(0);
for (int i = 0; i < 10; ++i) {
assertThat(parcel.readString()).isEqualTo(Integer.toString(i));
}
// now try to read past the number of items written and see what happens
assertThat(parcel.readString()).isNull();
}
代码示例来源:origin: android-hacker/VirtualXposed
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.mode);
dest.writeInt(this.installFlags);
dest.writeInt(this.installLocation);
dest.writeLong(this.sizeBytes);
dest.writeString(this.appPackageName);
dest.writeParcelable(this.appIcon, flags);
dest.writeString(this.appLabel);
dest.writeLong(this.appIconLastModified);
dest.writeParcelable(this.originatingUri, flags);
dest.writeParcelable(this.referrerUri, flags);
dest.writeString(this.abiOverride);
dest.writeString(this.volumeUuid);
dest.writeStringArray(this.grantedRuntimePermissions);
}
代码示例来源:origin: JackyAndroid/AndroidTVLauncher
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
dest.writeString(title);
dest.writeString(content);
dest.writeString(imageUrl);
dest.writeString(videoUrl);
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testInvalidReadFromOverwrittenObject() {
parcel.writeString("hello all");
parcel.setDataPosition(4);
parcel.writeInt(5);
parcel.setDataPosition(0);
try {
parcel.readString();
fail("should have thrown UnreliableBehaviorError");
} catch (UnreliableBehaviorError e) {
assertThat(e)
.hasMessage(
"Looking for String at position 0, found String [hello all] taking 24 bytes, but "
+ "[5] interrupts it at position 4");
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testWriteNullString() {
parcel.writeString(null);
parcel.setDataPosition(0);
assertThat(parcel.readString()).isNull();
assertThat(parcel.dataPosition()).isEqualTo(4);
}
代码示例来源: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());
}
内容来源于网络,如有侵权,请联系作者删除!