0

hi all,

i have a java code,

here "rs" is a result set.

ByteArrayInputStream byteStream = new ByteArrayInputStream(rs.getBytes(objName));

ObjectInputStream objStream = new ObjectInputStream(byteStream);

obj = objStream.readObject();

return obj;


i cant understand why it is used both "ByteArrayInputStream" and "ObjectInputStream"...?


can't i do this with one inputStream....?

please help me............!

thank you.....

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by rpjanaka
0

The ObjectInputStream can only be created using another InputStream of some type. A quick look at the API docu would tell you this. So no, you can't. You could combine it all on one line rather than using itermediate statements, but the work done is the same and is only more confusing to look at.

0

it is requered to get the database column into a vector object. i want to know why doing so complex way

insted of this way is it possible to use

rs.getString() method and the returned value can be inserted to the vector object.


is this possible...?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.