mirror of
https://github.com/revanced/jadb.git
synced 2025-02-05 23:16:47 +01:00
Small fixes
- replace if with switch - remove unnecessary toString()
This commit is contained in:
parent
a6dcb3ec38
commit
3c4b0c6997
@ -186,7 +186,7 @@ public class JadbDevice {
|
||||
public void push(InputStream source, long lastModified, int mode, RemoteFile remote) throws IOException, JadbException {
|
||||
try (Transport transport = getTransport()) {
|
||||
SyncTransport sync = transport.startSync();
|
||||
sync.send("SEND", remote.getPath() + "," + Integer.toString(mode));
|
||||
sync.send("SEND", remote.getPath() + "," + mode);
|
||||
|
||||
sync.sendStream(source);
|
||||
|
||||
|
@ -178,13 +178,19 @@ class AdbProtocolHandler implements Runnable {
|
||||
try {
|
||||
String id = readString(input, 4);
|
||||
int length = readInt(input);
|
||||
if ("SEND".equals(id)) {
|
||||
syncSend(output, input, length);
|
||||
} else if ("RECV".equals(id)) {
|
||||
syncRecv(output, input, length);
|
||||
} else if ("LIST".equals(id)) {
|
||||
syncList(output, input, length);
|
||||
} else throw new JadbException("Unknown sync id " + id);
|
||||
switch (id) {
|
||||
case "SEND":
|
||||
syncSend(output, input, length);
|
||||
break;
|
||||
case "RECV":
|
||||
syncRecv(output, input, length);
|
||||
break;
|
||||
case "LIST":
|
||||
syncList(output, input, length);
|
||||
break;
|
||||
default:
|
||||
throw new JadbException("Unknown sync id " + id);
|
||||
}
|
||||
} catch (JadbException e) { // sync response with a different type of fail message
|
||||
SyncTransport sync = getSyncTransport(output, input);
|
||||
sync.send("FAIL", e.getMessage());
|
||||
|
Loading…
x
Reference in New Issue
Block a user