@Override public Void invoke(File f, VirtualChannel channel) throws IOException { try (InputStream in = pipe.getIn()) { readFromTar(remote + '/' + description, f, TarCompression.GZIP.extract(in)); return null; } } }
return new java.util.zip.GZIPInputStream(p.getIn());
/** * Reads this file. */ public InputStream read() throws IOException, InterruptedException { if(channel==null) { return Files.newInputStream(fileToPath(reading(new File(remote)))); } final Pipe p = Pipe.createRemoteToLocal(); actAsync(new Read(p)); return p.getIn(); } private class Read extends SecureFileCallable<Void> {
@Override public void run() { cta.authenticate(protocol,channel,new Connection(c2s.getIn(), s2c.getOut())); } }.start();
@Override public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException { printCommandLine(cmd, _workDir); Pipe out = Pipe.createRemoteToLocal(); final String workDir = _workDir==null ? null : _workDir.getRemote(); OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides)); return new Channel("remotely launched channel on "+channel, Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os)); }
/** * 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(); } }
readFromTar(remote + '/' + description,new File(target.remote),TarCompression.GZIP.extract(pipe.getIn())); } catch (IOException e) {// BuildException or IOException try {
private Object readResolve() { assert in==null; this.in = pipe.getIn(); assert out!=null; assert socket==null; return this; }
public Void invoke(File f, VirtualChannel channel) throws IOException { try { readFromTar(remote + '/' + fileMask, f, (remoteCompressionType != null? remoteCompressionType.extract(pipe.getIn()) : FilePath.TarCompression.GZIP.extract(pipe.getIn()))); return null; } finally { pipe.getIn().close(); } } });
public Void invoke(File f, VirtualChannel channel) throws IOException { try { readFromTar(remote + '/' + fileMask, f, (remoteCompressionType != null? remoteCompressionType.extract(pipe.getIn()) : FilePath.TarCompression.GZIP.extract(pipe.getIn()))); return null; } finally { pipe.getIn().close(); } } });
public Void invoke(File f, VirtualChannel channel) throws IOException { try { readFromTar(remote + '/' + fileMask, f, (remoteCompressionType != null? remoteCompressionType.extract(pipe.getIn()) : FilePath.TarCompression.GZIP.extract(pipe.getIn()))); return null; } finally { pipe.getIn().close(); } } });
public Void invoke(File f, VirtualChannel channel) throws IOException { try { readFromTar(remote + '/' + fileMask, f, (remoteCompressionType != null ? remoteCompressionType.extract(pipe.getIn()) : FilePath.TarCompression.GZIP.extract(pipe.getIn())), nativeUtils); return null; } finally { pipe.getIn().close(); } } });
public Void invoke(File f, VirtualChannel channel) throws IOException { try (InputStream in = pipe.getIn()) { readFromTar(remote + '/' + description, f,TarCompression.GZIP.extract(in)); return null; } } });
@Override public void run() { cta.authenticate(protocol,channel,new Connection(c2s.getIn(), s2c.getOut())); } }.start();
@Override public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException { printCommandLine(cmd, _workDir); Pipe out = Pipe.createRemoteToLocal(); final String workDir = _workDir==null ? null : _workDir.getRemote(); OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides)); return new Channel("remotely launched channel on "+channel, Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os)); }
public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException { printCommandLine(cmd, _workDir); Pipe out = Pipe.createRemoteToLocal(); final String workDir = _workDir==null ? null : _workDir.getRemote(); OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides)); return new Channel("remotely launched channel on "+channel, Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os)); }
public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException { printCommandLine(cmd, _workDir); Pipe out = Pipe.createRemoteToLocal(); final String workDir = _workDir==null ? null : _workDir.getRemote(); OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides)); return new Channel("remotely launched channel on "+channel, Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os)); }
public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir, Map<String,String> envOverrides) throws IOException, InterruptedException { printCommandLine(cmd, _workDir); Pipe out = Pipe.createRemoteToLocal(); final String workDir = _workDir==null ? null : _workDir.getRemote(); OutputStream os = getChannel().call(new RemoteChannelLaunchCallable(cmd, out, err, workDir, envOverrides)); return new Channel("remotely launched channel on "+channel, Computer.threadPoolForRemoting, out.getIn(), new BufferedOutputStream(os)); }
private static void read(Pipe p) throws IOException, AssertionError { try (InputStream in = p.getIn()) { for( int cnt=0; cnt<256*256; cnt++ ) { assertEquals(cnt/256,in.read()); } assertEquals(-1,in.read()); } }