Package hudson.util
Class StreamTaskListener
java.lang.Object
hudson.util.AbstractTaskListener
hudson.util.StreamTaskListener
- All Implemented Interfaces:
TaskListener,Closeable,Serializable,AutoCloseable,org.jenkinsci.remoting.SerializableOnlyOverRemoting
- Direct Known Subclasses:
StreamBuildListener
TaskListener that generates output into a single stream.
This object is remotable.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Field Summary
Fields inherited from interface hudson.model.TaskListener
NULL -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.StreamTaskListener(File out) Deprecated.as of TODO The caller should useStreamTaskListener(File, Charset)to pass in the charset and file separately, so that this class can handle encoding correctly.StreamTaskListener(File out, boolean append, Charset charset) Constructs aStreamTaskListenerthat sends the output to a specified file.StreamTaskListener(File out, Charset charset) Deprecated.as of TODO The caller should useStreamTaskListener(OutputStream, Charset)to pass in the charset and output stream separately, so that this class can handle encoding correctly, or usefromStdout()orfromStderr().StreamTaskListener(OutputStream out, Charset charset) Deprecated.as of 1.349 The caller should useStreamTaskListener(OutputStream, Charset)to pass in the charset and output stream separately, so that this class can handle encoding correctly, or usefromStdout()orfromStderr(). -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidCloses this listener and swallows any exceptions, if raised.static StreamTaskListenerstatic StreamTaskListenerA charset to use for methods returningPrintWriter.This writer will receive the output of the buildMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jenkinsci.remoting.SerializableOnlyOverRemoting
getChannelForSerializationMethods inherited from interface hudson.model.TaskListener
annotate, error, error, fatalError, fatalError, hyperlink
-
Constructor Details
-
StreamTaskListener
Deprecated.as of 1.349 The caller should useStreamTaskListener(OutputStream, Charset)to pass in the charset and output stream separately, so that this class can handle encoding correctly, or usefromStdout()orfromStderr(). -
StreamTaskListener
Deprecated.as of TODO The caller should useStreamTaskListener(OutputStream, Charset)to pass in the charset and output stream separately, so that this class can handle encoding correctly, or usefromStdout()orfromStderr(). -
StreamTaskListener
-
StreamTaskListener
Deprecated.as of TODO The caller should useStreamTaskListener(File, Charset)to pass in the charset and file separately, so that this class can handle encoding correctly.- Throws:
IOException
-
StreamTaskListener
- Throws:
IOException
-
StreamTaskListener
public StreamTaskListener(@NonNull File out, boolean append, @CheckForNull Charset charset) throws IOException Constructs aStreamTaskListenerthat sends the output to a specified file.- Parameters:
out- the file.append- iftrue, then output will be written to the end of the file rather than the beginning.charset- if non-nullthen the charset to use when writing.- Throws:
IOException- if the file could not be opened.- Since:
- 1.651
-
StreamTaskListener
- Throws:
IOException
-
StreamTaskListener
Deprecated.as of 1.349 UseTaskListener.NULL- Throws:
IOException
-
-
Method Details
-
fromStdout
-
fromStderr
-
getLogger
Description copied from interface:TaskListenerThis writer will receive the output of the build- Specified by:
getLoggerin interfaceTaskListener
-
getCharset
Description copied from interface:TaskListenerA charset to use for methods returningPrintWriter. Should match that used to constructTaskListener.getLogger().- Specified by:
getCharsetin interfaceTaskListener- Returns:
- by default, UTF-8
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
closeQuietly
public void closeQuietly()Closes this listener and swallows any exceptions, if raised.- Since:
- 1.349
-
TaskListener.NULL