mirror of
https://github.com/revanced/jadb.git
synced 2025-02-05 23:16:47 +01:00
Use try-with-resources for reading/writing files
This commit is contained in:
parent
cb989acfa9
commit
45c67bad0a
@ -163,9 +163,9 @@ public class JadbDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void push(File local, RemoteFile remote) throws IOException, JadbException {
|
public void push(File local, RemoteFile remote) throws IOException, JadbException {
|
||||||
FileInputStream fileStream = new FileInputStream(local);
|
try (FileInputStream fileStream = new FileInputStream(local)) {
|
||||||
push(fileStream, local.lastModified(), getMode(local), remote);
|
push(fileStream, local.lastModified(), getMode(local), remote);
|
||||||
fileStream.close();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pull(RemoteFile remote, OutputStream destination) throws IOException, JadbException {
|
public void pull(RemoteFile remote, OutputStream destination) throws IOException, JadbException {
|
||||||
@ -177,9 +177,9 @@ public class JadbDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void pull(RemoteFile remote, File local) throws IOException, JadbException {
|
public void pull(RemoteFile remote, File local) throws IOException, JadbException {
|
||||||
FileOutputStream fileStream = new FileOutputStream(local);
|
try (FileOutputStream fileStream = new FileOutputStream(local)) {
|
||||||
pull(remote, fileStream);
|
pull(remote, fileStream);
|
||||||
fileStream.close();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void send(Transport transport, String command) throws IOException, JadbException {
|
private void send(Transport transport, String command) throws IOException, JadbException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user