Java源码示例:hudson.remoting.RemoteOutputStream
示例1
/** @see FilePath#write() */
private static OutputStream append(FilePath fp, OutputStream stream) throws IOException, InterruptedException {
if (stream == null) {
return fp.act(new MasterToSlaveFileCallable<OutputStream>() {
private static final long serialVersionUID = 1L;
@Override
public OutputStream invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
f = f.getAbsoluteFile();
if (!f.getParentFile().exists() && !f.getParentFile().mkdirs()) {
throw new IOException("Failed to create directory " + f.getParentFile());
}
try {
return new RemoteOutputStream(Files.newOutputStream(f.toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND/*, StandardOpenOption.DSYNC*/));
} catch (InvalidPathException e) {
throw new IOException(e);
}
}
});
}
return stream;
}
示例2
Invocation(Method method, @NonNull Object[] args) {
this.methodName = method.getName();
this.args = args;
this.parameterTypes = new String[args.length];
Class[] paramTypes = method.getParameterTypes();
for (int i=0; i<args.length; i++) {
parameterTypes[i] = paramTypes[i].getName();
}
for (int i=0; i<args.length; i++) {
if (args[i] instanceof OutputStream)
args[i] = new RemoteOutputStream((OutputStream)args[i]);
if (args[i] instanceof Writer)
args[i] = new RemoteWriter((Writer)args[i]);
}
}
示例3
public int execute(List<String> args, InputStream stdin, OutputStream stdout, OutputStream stderr) {
return entryPoint.main(args, Locale.getDefault(),
new RemoteInputStream(stdin, NOT_GREEDY),
new RemoteOutputStream(stdout),
new RemoteOutputStream(stderr));
}
示例4
private OutputStream wrap(OutputStream os) {
return new RemoteOutputStream(os);
}