@Override public InputStream open() throws IOException { try { return f.read(); } catch (InterruptedException x) { throw new IOException(x); } } @Override public <V> V run(Callable<V,IOException> callable) throws IOException {
@Override public Void invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException { readFromTar(FilePath.this.getName(), dir, compression.extract(FilePath.this.read())); return null; } private static final long serialVersionUID = 1L;
public ClientAuthenticationCache(Channel channel) throws IOException, InterruptedException { store = (channel==null ? FilePath.localChannel : channel).call(new CredentialsFilePathMasterToSlaveCallable()); if (store.exists()) { try (InputStream istream = store.read()) { props.load(istream); } } }
/** * When this {@link FilePath} represents a zip file, extracts that zip file. * * @param target * Target directory to expand files to. All the necessary directories will be created. * @since 1.248 * @see #unzipFrom(InputStream) */ public void unzip(final FilePath target) throws IOException, InterruptedException { // TODO: post release, re-unite two branches by introducing FileStreamCallable that resolves InputStream if (this.channel!=target.channel) {// local -> remote or remote->local final RemoteInputStream in = new RemoteInputStream(read(), Flag.GREEDY); target.act(new UnzipRemote(in)); } else {// local -> local or remote->remote target.act(new UnzipLocal()); } } private class UnzipRemote extends SecureFileCallable<Void> {
/** * When this {@link FilePath} represents a tar file, extracts that tar file. * * @param target * Target directory to expand files to. All the necessary directories will be created. * @param compression * Compression mode of this tar file. * @since 1.292 * @see #untarFrom(InputStream, TarCompression) */ public void untar(final FilePath target, final TarCompression compression) throws IOException, InterruptedException { // TODO: post release, re-unite two branches by introducing FileStreamCallable that resolves InputStream if (this.channel!=target.channel) {// local -> remote or remote->local final RemoteInputStream in = new RemoteInputStream(read(), Flag.GREEDY); target.act(new UntarRemote(compression, in)); } else {// local -> local or remote->remote target.act(new UntarLocal(compression)); } } private class UntarRemote extends SecureFileCallable<Void> {
public Void invoke(File dir, VirtualChannel channel) throws IOException { unzip(dir,FilePath.this.read()); return null; } private static final long serialVersionUID = 1L;
public InputStream getInputStream() throws IOException { InputStream stream = null; try { stream = file.read(); } catch(InterruptedException e) { stream = null; } return stream; }
/** * Reads this file into a string, by using the current system encoding. */ public String readToString() throws IOException, InterruptedException { try (InputStream in = read()) { return org.apache.commons.io.IOUtils.toString(in); } }
@Override public InputStream open() throws IOException { try { return f.read(); } catch (InterruptedException x) { throw (IOException) new IOException(x.toString()).initCause(x); } } @Override public <V> V run(Callable<V,IOException> callable) throws IOException {
/** * Reads this file into a string, by using the current system encoding. */ public String readToString() throws IOException { InputStream in = read(); try { return IOUtils.toString(in); } finally { in.close(); } }
/** * Reads this file into a string, by using the current system encoding. */ public String readToString() throws IOException { InputStream in = read(); try { return IOUtils.toString(in); } finally { in.close(); } }
/** * Reads this file into a string, by using the current system encoding. */ public String readToString() throws IOException { InputStream in = read(); try { return IOUtils.toString(in); } finally { in.close(); } }
private String readFile(String fileName) throws AbortException { try { try (InputStream is = workspace.child(fileName).read()) { return IOUtils.toString(is, Charsets.UTF_8); } } catch (Exception e) { throw new AbortException("Unable to read file " + fileName + ". " + e); } }
public ClientAuthenticationCache(Channel channel) throws IOException, InterruptedException { store = (channel==null ? MasterComputer.localChannel : channel).call(new Callable<FilePath, IOException>() { public FilePath call() throws IOException { File home = new File(System.getProperty("user.home")); return new FilePath(new File(home, ".hudson/cli-credentials")); } }); if (store.exists()) { props.load(store.read()); } }
public ClientAuthenticationCache(Channel channel) throws IOException, InterruptedException { store = (channel == null ? MasterComputer.localChannel : channel).call(new Callable<FilePath, IOException>() { public FilePath call() throws IOException { File home = new File(System.getProperty("user.home")); return new FilePath(new File(home, ".hudson/cli-credentials")); } }); if (store.exists()) { props.load(store.read()); } }
public ClientAuthenticationCache(Channel channel) throws IOException, InterruptedException { store = (channel==null ? MasterComputer.localChannel : channel).call(new Callable<FilePath, IOException>() { public FilePath call() throws IOException { File home = new File(System.getProperty("user.home")); return new FilePath(new File(home, ".hudson/cli-credentials")); } }); if (store.exists()) { props.load(store.read()); } }
public byte[] readFileFromMaster(final String filePath) { final FilePath file = configDir.child(filePath); InputStream inputStream = null; try { inputStream = file.read(); return IOUtils.toByteArray(inputStream); } catch (IOException ioe) { throw new BapPublisherException(Messages.exception_readFile(filePath, ioe.getLocalizedMessage()), ioe); } finally { IOUtils.closeQuietly(inputStream); } }
public Void invoke(File dir, VirtualChannel channel) throws IOException, InterruptedException { readFromTar(FilePath.this.getName(),dir,compression.extract(FilePath.this.read())); return null; } private static final long serialVersionUID = 1L;
public Void invoke(File dir, VirtualChannel channel) throws IOException { readFromTar(FilePath.this.getName(), dir, compression.extract(FilePath.this.read()), nativeUtils); return null; } private static final long serialVersionUID = 1L;
public Void invoke(File dir, VirtualChannel channel) throws IOException { readFromTar(FilePath.this.getName(),dir,compression.extract(FilePath.this.read())); return null; } private static final long serialVersionUID = 1L;