class ModemReader extends Thread {
InputStream in=SimpleSMSReader.inputStream;
int c;
public void run() {try {while(true) {
if(SimpleSMSReader.readMessage==true) {
c=in.read();
while (c != -1)
{
queue.put((byte) c);
c = in.read();
}
SimpleSMSReader.readMessage=false;
//Here i have to write some code to parse the message.
// ie.. only after reading the whole data available.
//but in this case it is not exiting from the loop instead
// it waits for another data availability.and reads when
// data available.
}
}
}catch(Exception e) {
System.out.println(e.toString());
}
}
}
description:
When some data is available in the inputStream,the static variable
readMessage in the class SimpleSMSReader is set to
True.