public Void invoke(File f, VirtualChannel channel) throws IOException { try (OutputStream os = p.getOut(); OutputStream out = new java.util.zip.GZIPOutputStream(os, 8192); RandomAccessFile raf = new RandomAccessFile(reading(f), "r")) { raf.seek(offset); byte[] buf = new byte[8192]; int len; while ((len = raf.read(buf)) >= 0) { out.write(buf, 0, len); } return null; } } });
@Override public Integer invoke(File f, VirtualChannel channel) throws IOException { try (OutputStream out = pipe.getOut()) { return writeToTar(f, scanner, TarCompression.GZIP.compress(out)); } } }
@Override public Integer invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { return writeToTar(new File(remote), scanner, TarCompression.GZIP.compress(pipe.getOut())); } }
@Override public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { try (InputStream fis = Files.newInputStream(fileToPath(reading(f))); OutputStream out = p.getOut()) { org.apache.commons.io.IOUtils.copy(fis, out); } catch (Exception x) { p.error(x); } return null; } }
public OutputStream call() throws IOException { Process p = Runtime.getRuntime().exec(cmd, Util.mapToEnv(inherit(envOverrides)), workDir == null ? null : new File(workDir)); List<String> cmdLines = Arrays.asList(cmd); new StreamCopyThread("stdin copier for remote agent on "+cmdLines, p.getInputStream(), out.getOut()).start(); new StreamCopyThread("stderr copier for remote agent on "+cmdLines, p.getErrorStream(), err).start(); // TODO: don't we need to join? return new RemoteOutputStream(p.getOutputStream()); }
@Override public void run() { cta.authenticate(protocol,channel,new Connection(c2s.getIn(), s2c.getOut())); } }.start();
/** * Authenticate ourselves against the server. * * @return * identity of the server represented as a public key. * @deprecated Specific to {@link Mode#REMOTING}. */ @Deprecated public PublicKey authenticate(Iterable<KeyPair> privateKeys) throws IOException, GeneralSecurityException { Pipe c2s = Pipe.createLocalToRemote(); Pipe s2c = Pipe.createRemoteToLocal(); entryPoint.authenticate("ssh",c2s, s2c); Connection c = new Connection(s2c.getIn(), c2s.getOut()); try { byte[] sharedSecret = c.diffieHellman(false).generateSecret(); PublicKey serverIdentity = c.verifyIdentity(sharedSecret); // try all the public keys for (KeyPair key : privateKeys) { c.proveIdentity(sharedSecret,key); if (c.readBoolean()) return serverIdentity; // succeeded } if (privateKeys.iterator().hasNext()) throw new GeneralSecurityException("Authentication failed. No private key accepted."); else throw new GeneralSecurityException("No private key is available for use in authentication"); } finally { c.close(); } }
public Integer invoke(File f, VirtualChannel channel) throws IOException { try { return writeToTar(f, fileMask, excludes, (remoteCompressionType != null? remoteCompressionType.compress(pipe.getOut()) : FilePath.TarCompression.GZIP.compress(pipe.getOut()))); } finally { pipe.getOut().close(); } } });
public Integer invoke(File f, VirtualChannel channel) throws IOException { try (OutputStream out = pipe.getOut()) { return writeToTar(f, scanner, TarCompression.GZIP.compress(out)); } } });
@Override public void run() { OutputStream os = p.getOut(); try { byte[] buf = new byte[Channel.PIPE_WINDOW_SIZE * 2 + 1]; os.write(buf); } catch (IOException e) { e.printStackTrace(); } } };
@Override public void run() { OutputStream os = p.getOut(); try { byte[] buf = new byte[Channel.PIPE_WINDOW_SIZE*2+1]; os.write(buf); } catch (IOException e) { e.printStackTrace(); } } };
public OutputStream call() throws IOException { Process p = Runtime.getRuntime().exec(cmd, Util.mapToEnv(inherit(envOverrides)), workDir == null ? null : new File(workDir)); List<String> cmdLines = Arrays.asList(cmd); new StreamCopyThread("stdin copier for remote agent on "+cmdLines, p.getInputStream(), out.getOut()).start(); new StreamCopyThread("stderr copier for remote agent on "+cmdLines, p.getErrorStream(), err).start(); // TODO: don't we need to join? return new RemoteOutputStream(p.getOutputStream()); }
public OutputStream call() throws IOException { Process p = Runtime.getRuntime().exec(cmd, Util.mapToEnv(inherit(envOverrides)), workDir == null ? null : new File(workDir)); List<String> cmdLines = Arrays.asList(cmd); new StreamCopyThread("stdin copier for remote agent on "+cmdLines, p.getInputStream(), out.getOut()).start(); new StreamCopyThread("stderr copier for remote agent on "+cmdLines, p.getErrorStream(), err).start(); // TODO: don't we need to join? return new RemoteOutputStream(p.getOutputStream()); }
public OutputStream call() throws IOException { Process p = Runtime.getRuntime().exec(cmd, Util.mapToEnv(inherit(envOverrides)), workDir == null ? null : new File(workDir)); List<String> cmdLines = Arrays.asList(cmd); new StreamCopyThread("stdin copier for remote agent on "+cmdLines, p.getInputStream(), out.getOut()).start(); new StreamCopyThread("stderr copier for remote agent on "+cmdLines, p.getErrorStream(), err).start(); // TODO: don't we need to join? return new RemoteOutputStream(p.getOutputStream()); }
public OutputStream call() throws IOException { Process p = Runtime.getRuntime().exec(cmd, Util.mapToEnv(inherit(envOverrides)), workDir == null ? null : new File(workDir)); List<String> cmdLines = Arrays.asList(cmd); new StreamCopyThread("stdin copier for remote agent on "+cmdLines, p.getInputStream(), out.getOut()).start(); new StreamCopyThread("stderr copier for remote agent on "+cmdLines, p.getErrorStream(), err).start(); // TODO: don't we need to join? return new RemoteOutputStream(p.getOutputStream()); }
@Override public void run() { cta.authenticate(protocol,channel,new Connection(c2s.getIn(), s2c.getOut())); } }.start();
private Object writeReplace() { Pipe p = Pipe.createLocalToRemote(); // the thread will terminate when there's nothing more to read. new StreamCopyThread("Stream reader: maven process at "+socket,in,p.getOut(),true).start(); return new Connection(p,new RemoteOutputStream(out)); }