4

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?

Explosion Pills
  • 188,624
  • 52
  • 326
  • 405

1 Answers1

4

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • 1
    Yes that is what I am doing. I think my problem is lying elsewhere, but I wanted to make sure that readObject() was the right thing to use. Wish me luck.. – Explosion Pills Nov 04 '10 at 00:09