mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 15:20:54 +03:00
no need to copy
This commit is contained in:
@@ -22,7 +22,6 @@ import java.io.Closeable;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class StreamCopier
|
public class StreamCopier
|
||||||
extends Thread {
|
extends Thread {
|
||||||
@@ -34,10 +33,9 @@ public class StreamCopier
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ErrorCallback closeOnErrorCallback(final Closeable... toClose) {
|
public static ErrorCallback closeOnErrorCallback(final Closeable... toClose) {
|
||||||
final Closeable[] closeables = Arrays.copyOf(toClose, toClose.length);
|
|
||||||
return new ErrorCallback() {
|
return new ErrorCallback() {
|
||||||
public void onError(IOException ioe) {
|
public void onError(IOException ioe) {
|
||||||
IOUtils.closeQuietly(closeables);
|
IOUtils.closeQuietly(toClose);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user