using syncWrite and syncRead new methods in Streams

rabidaudio-outputstream-fix
Felipe Herranz 2019-07-07 23:07:42 +02:00
rodzic 90396ab436
commit 538e2e0483
2 zmienionych plików z 2 dodań i 7 usunięć

Wyświetl plik

@ -73,10 +73,7 @@ public class SerialInputStream extends InputStream
return read(b);
}
byte[] slice = new byte[len];
int ret = device.syncRead(slice, timeout);
System.arraycopy(slice, 0, b, off, ret);
return ret;
return device.syncRead(b, off, len, timeout);
}
@Override

Wyświetl plik

@ -45,9 +45,7 @@ public class SerialOutputStream extends OutputStream
return;
}
byte[] slice = new byte[len];
System.arraycopy(b, off, slice, 0, len);
device.syncWrite(slice, timeout);
device.syncWrite(b, off, len, timeout);
}
public void setTimeout(int timeout) {