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);
|
return read(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] slice = new byte[len];
|
return device.syncRead(b, off, len, timeout);
|
||||||
int ret = device.syncRead(slice, timeout);
|
|
||||||
System.arraycopy(slice, 0, b, off, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,9 +45,7 @@ public class SerialOutputStream extends OutputStream
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] slice = new byte[len];
|
device.syncWrite(b, off, len, timeout);
|
||||||
System.arraycopy(b, off, slice, 0, len);
|
|
||||||
device.syncWrite(slice, timeout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeout(int timeout) {
|
public void setTimeout(int timeout) {
|
||||||
|
|
Ładowanie…
Reference in New Issue