开发者

ObjectInputStream read Array

开发者 https://www.devze.com 2023-01-23 23:11 出处:网络
I am trying to read in an array from ObjectInputStream in Java.I can find no documentation on how to do this.I assume that it开发者_开发百科 is readObject(), but this doesn\'t seem to work.

I am trying to read in an array from ObjectInputStream in Java. I can find no documentation on how to do this. I assume that it开发者_开发百科 is readObject(), but this doesn't seem to work.

out.write(Object)
out.write(Object)
out.write(boolean[])

... in servlet ...

Object one = in.readObject();
Object two = in.readObject();
boolean[] thr = (boolean[])in.readObject();

Is this correct or am I doing it wrong? If it's correct then any ideas on why it might not like this?


Your reading code is correct. Your writing pseudo-code is also correct, assuming that it really is pseudo-code and that you are actually calling those methods with arguments of those types in that order.

0

精彩评论

暂无评论...
验证码 换一张
取 消