|
Author |
Topic: Smoother file input? (Read 320 times) |
|
rgovostes
|
Smoother file input?
« on: Sep 7th, 2003, 8:05pm » |
|
I've written an applet which get a bunch of numbers from a URL and writes them out on the screen. When it runs out of numbers, it requests more from the page. Currently I use loadStrings() to load the file into an array, then I loop through the array printing the numbers out. When I run out of numbers, it requests more. However, there is a pause while it is loading them. Does anyone have any suggestions for making this seem smoother?
|
|
|
|
benelek
|
Re: Smoother file input?
« Reply #1 on: Sep 10th, 2003, 2:10am » |
|
you could have a buffer of data, so you don't start spitting the output at the begining until you have the info for the next group... then you're always a bit ahead of things, and you can slow things down smoothly if you need to.
|
|
|
|
fry
|
Re: Smoother file input?
« Reply #2 on: Sep 13th, 2003, 3:15pm » |
|
if you just use the regular java file i/o, and put it in a loop or even a thread, you'll get smoother behavior. this is much more complicated, which is why the file i/o we provide by default is just a simple "grab this chunk of data". the java tutorial oughta have something about reading from a file. i don't have a link offhand tho.
|
|
|
|
|