Skip to content

Commit

Permalink
using syncWrite and syncRead new methods in Streams
Browse files Browse the repository at this point in the history
  • Loading branch information
felHR85 committed Jul 7, 2019
1 parent 90396ab commit 538e2e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ public int read(byte b[], int off, int len)
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ public void write(byte b[], int off, int len)
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) {
Expand Down

0 comments on commit 538e2e0

Please sign in to comment.