File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes reading into a vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "reading into a vector" Watch "reading into a vector" New topic

reading into a vector

Chanpreet Julka
Ranch Hand

Joined: Nov 09, 2001
Posts: 40
I am reading from a BufferedInputStream, which has data from a database. I wan't insert the data into a vector as strings, but It doesn't work like this, because it inserts the byte and I get an error. Please help.
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("some directory");
InputStream stream = proc.getInputStream();
BufferedInputStream in = new BufferedInputStream(stream);
int i = 0;

while( (i = != -1) {
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
I think you'll need to identify how you want these bytes put together before you put them into a vector. Do you want to put them in as words, sentences or other. You can't bytes into the Vector because vectors only accept objects. A byte is a primative and won't go into it. I guess the question then is, what is your purpose of doing this. Then you can decide how to put these bytes together. Once you have this... maybe in some String format.... then you can easily put them into a Vector.

By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
I agree. Here's the link:
subject: reading into a vector
jQuery in Action, 3rd edition