> I need to interrupt an InputStream blocked on the
> read() call. this stream is not necessarily a socket,
> so soTimeout will not work here.
>
> I have tried interrupt on the thread, but it does not
> work. any ideas?
By only doing the read if a character is available.
while(in.available())
{
... in.read ( ... ) ;
}
> I need to interrupt an InputStream blocked on the
> read() call. this stream is not necessarily a socket,
> so soTimeout will not work here.
>
> I have tried interrupt on the thread, but it does not
> work. any ideas?
By only doing the read if a character is available.
while(in.available()){ ... in.read ( ... ) ;}
> > I need to interrupt an InputStream blocked on the
> > read() call. this stream is not necessarily a
> socket,
> > so soTimeout will not work here.
> >
> > I have tried interrupt on the thread, but it does
> not
> > work. any ideas?
>
> By only doing the read if a character is available.
>
> while(in.available()){ ... in.read ( ... )
> ;}
This is an infinitely more robust solution than the technique I was using. It has eliminated lots of code and 1 thread from my program.
I guess you have to look closer and be sure to make good use of the threads that are already present before you make new ones.
Thank you!!