提交 55f9f15f authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Simplify readBoolean() and writeString() in Transfer

上级 0ff4499b
...@@ -104,7 +104,7 @@ public class Transfer { ...@@ -104,7 +104,7 @@ public class Transfer {
* @return the value * @return the value
*/ */
public boolean readBoolean() throws IOException { public boolean readBoolean() throws IOException {
return in.readByte() == 1; return in.readByte() != 0;
} }
/** /**
...@@ -217,11 +217,8 @@ public class Transfer { ...@@ -217,11 +217,8 @@ public class Transfer {
if (s == null) { if (s == null) {
out.writeInt(-1); out.writeInt(-1);
} else { } else {
int len = s.length(); out.writeInt(s.length());
out.writeInt(len); out.writeChars(s);
for (int i = 0; i < len; i++) {
out.writeChar(s.charAt(i));
}
} }
return this; return this;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论