mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
Don't buffer files in memory.
Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
parent
ec0d118e23
commit
7bd13e741b
1 changed files with 9 additions and 12 deletions
|
@ -1,7 +1,5 @@
|
||||||
package org.eclipse.remote.internal.jsch.core.commands;
|
package org.eclipse.remote.internal.jsch.core.commands;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
@ -10,7 +8,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.SubMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.remote.core.exception.RemoteConnectionException;
|
import org.eclipse.remote.core.exception.RemoteConnectionException;
|
||||||
import org.eclipse.remote.internal.jsch.core.JSchConnection;
|
import org.eclipse.remote.internal.jsch.core.JSchConnection;
|
||||||
import org.eclipse.remote.internal.jsch.core.messages.Messages;
|
|
||||||
|
|
||||||
import com.jcraft.jsch.JSchException;
|
import com.jcraft.jsch.JSchException;
|
||||||
import com.jcraft.jsch.SftpException;
|
import com.jcraft.jsch.SftpException;
|
||||||
|
@ -26,19 +23,19 @@ public class GetInputStreamCommand extends AbstractRemoteCommand<InputStream> {
|
||||||
@Override
|
@Override
|
||||||
public InputStream getResult(IProgressMonitor monitor) throws RemoteConnectionException {
|
public InputStream getResult(IProgressMonitor monitor) throws RemoteConnectionException {
|
||||||
final SubMonitor subMon = SubMonitor.convert(monitor, 10);
|
final SubMonitor subMon = SubMonitor.convert(monitor, 10);
|
||||||
final ByteArrayOutputStream out = new ByteArrayOutputStream();
|
SftpCallable<InputStream> c = new SftpCallable<InputStream>() {
|
||||||
SftpCallable<Void> c = new SftpCallable<Void>() {
|
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws JSchException, SftpException, IOException {
|
public InputStream call() throws JSchException, SftpException, IOException {
|
||||||
getChannel().get(fRemotePath.toString(), out, new CommandProgressMonitor(getProgressMonitor()));
|
try {
|
||||||
out.close();
|
return getConnection().getSftpChannel().get(fRemotePath.toString(),
|
||||||
return null;
|
new CommandProgressMonitor(getProgressMonitor()));
|
||||||
|
} catch (RemoteConnectionException e) {
|
||||||
|
throw new IOException(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
subMon.subTask(Messages.GetInputStreamCommand_Get_input_stream);
|
return c.getResult(subMon.newChild(10));
|
||||||
c.getResult(subMon.newChild(10));
|
|
||||||
return new ByteArrayInputStream(out.toByteArray());
|
|
||||||
} catch (SftpException e) {
|
} catch (SftpException e) {
|
||||||
throw new RemoteConnectionException(e.getMessage());
|
throw new RemoteConnectionException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue