kopia lustrzana https://github.com/felHR85/UsbSerial
using syncWrite and syncRead new methods in Streams
rodzic
90396ab436
commit
538e2e0483
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Ładowanie…
Reference in New Issue