hudson.remoting
Class StandardOutputStream
java.lang.Object
java.io.OutputStream
hudson.remoting.StandardOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class StandardOutputStream
- extends OutputStream
Hint that indicates that we are using stdout with fd=1 as the stream to write to for the channel.
Using stdin/stdout pair for the communication is very convenient for setting up a remote channel,
so Jenkins tends to do that, but even with our using System.setOut(PrintStream) to avoid
other parts of the Java code to accidentally corrupt the stream, file descriptor 1 continues to
point to the stream we use, so native code in JVM can still accidentally pollute the stream.
Fixing that requires the use of dup and close POSIX API calls, which we can only do after the communication
gets established and JNA is brought in via remoting. Having Launcher uses this wrapper class allows
us to do that without recreating the stream.
- Author:
- Kohsuke Kawaguchi
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StandardOutputStream
public StandardOutputStream()
swap
public OutputStream swap(OutputStream another)
- Atomically swaps the underlying stream to another stream and returns it.
isSwapped
public boolean isSwapped()
write
public void write(int b)
throws IOException
- Specified by:
write in class OutputStream
- Throws:
IOException
write
public void write(byte[] b)
throws IOException
- Overrides:
write in class OutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write in class OutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush in interface Flushable- Overrides:
flush in class OutputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Overrides:
close in class OutputStream
- Throws:
IOException
Copyright © 2004-2011. All Rights Reserved.