我有以下代码,我使用 ReadUnsignedByte() 函数但挂起并且不返回任何导致挂起应用程序的内容。我用了try catch但是没有响应,这种情况我该怎么办?
private int getEndOfSeqeunce(DataInputStream in, byte[] sequence) throws TimeoutException {
int seqIndex = 0;
byte c = -99;
for(int i=0; i < FRAME_MAX_LENGTH; i++) {
Log.v("DataInputStream", ""+in);
try {
c = (byte) in.readUnsignedByte(); // Stuck here ... No response at this line which hangs the Android application.
Log.v("C ::::::::UNSIGNE::readUnsignedByte::::::::", ""+c);
if(c == sequence[seqIndex]) {
seqIndex++;
if(seqIndex == sequence.length) return i + 1;
} else seqIndex = 0;
} catch (IOException e) {
e.printStackTrace();
i = FRAME_MAX_LENGTH;
Activity ac = (Activity) cox;
}
}
return -1;
}