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
ConstructorDescriptionDeprecated.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 aStreamTaskListener
that 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 TypeMethodDescriptionvoid
close()
void
Closes this listener and swallows any exceptions, if raised.static StreamTaskListener
static StreamTaskListener
A 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, wait
Methods inherited from interface org.jenkinsci.remoting.SerializableOnlyOverRemoting
getChannelForSerialization
Methods 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 aStreamTaskListener
that 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-null
then 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:TaskListener
This writer will receive the output of the build- Specified by:
getLogger
in interfaceTaskListener
-
getCharset
Description copied from interface:TaskListener
A charset to use for methods returningPrintWriter
. Should match that used to constructTaskListener.getLogger()
.- Specified by:
getCharset
in interfaceTaskListener
- Returns:
- by default, UTF-8
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
closeQuietly
public void closeQuietly()Closes this listener and swallows any exceptions, if raised.- Since:
- 1.349
-
TaskListener.NULL