hudson.util
Class StreamTaskListener

java.lang.Object
  extended by hudson.util.AbstractTaskListener
      extended by hudson.util.StreamTaskListener
All Implemented Interfaces:
TaskListener, Closeable, Serializable
Direct Known Subclasses:
StreamBuildListener

public class StreamTaskListener
extends AbstractTaskListener
implements Serializable, Closeable

TaskListener that generates output into a single stream.

This object is remotable.

Author:
Kohsuke Kawaguchi
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface hudson.model.TaskListener
NULL
 
Constructor Summary
StreamTaskListener()
          Deprecated. as of 1.349 Use TaskListener.NULL
StreamTaskListener(File out)
           
StreamTaskListener(File out, Charset charset)
           
StreamTaskListener(OutputStream out)
           
StreamTaskListener(OutputStream out, Charset charset)
           
StreamTaskListener(PrintStream out)
          Deprecated. as of 1.349 The caller should use StreamTaskListener(OutputStream, Charset) to pass in the charset and output stream separately, so that this class can handle encoding correctly, or use fromStdout() or fromStderr().
StreamTaskListener(Writer w)
           
 
Method Summary
 void annotate(ConsoleNote ann)
          Annotates the current position in the output log by using the given annotation.
 void close()
           
 void closeQuietly()
          Closes this listener and swallows any exceptions, if raised.
 PrintWriter error(String msg)
          An error in the build.
 PrintWriter error(String format, Object... args)
          Formatter.format(String, Object[]) version of TaskListener.error(String).
 PrintWriter fatalError(String msg)
          A fatal error in the build.
 PrintWriter fatalError(String format, Object... args)
          Formatter.format(String, Object[]) version of TaskListener.fatalError(String).
static StreamTaskListener fromStderr()
           
static StreamTaskListener fromStdout()
           
 PrintStream getLogger()
          This writer will receive the output of the build
 
Methods inherited from class hudson.util.AbstractTaskListener
hyperlink
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamTaskListener

public StreamTaskListener(PrintStream out)
Deprecated. as of 1.349 The caller should use StreamTaskListener(OutputStream, Charset) to pass in the charset and output stream separately, so that this class can handle encoding correctly, or use fromStdout() or fromStderr().


StreamTaskListener

public StreamTaskListener(OutputStream out)

StreamTaskListener

public StreamTaskListener(OutputStream out,
                          Charset charset)

StreamTaskListener

public StreamTaskListener(File out)
                   throws IOException
Throws:
IOException

StreamTaskListener

public StreamTaskListener(File out,
                          Charset charset)
                   throws IOException
Throws:
IOException

StreamTaskListener

public StreamTaskListener(Writer w)
                   throws IOException
Throws:
IOException

StreamTaskListener

public StreamTaskListener()
                   throws IOException
Deprecated. as of 1.349 Use TaskListener.NULL

Throws:
IOException
Method Detail

fromStdout

public static StreamTaskListener fromStdout()

fromStderr

public static StreamTaskListener fromStderr()

getLogger

public PrintStream getLogger()
Description copied from interface: TaskListener
This writer will receive the output of the build

Specified by:
getLogger in interface TaskListener
Returns:
must be non-null.

error

public PrintWriter error(String msg)
Description copied from interface: TaskListener
An error in the build.

Specified by:
error in interface TaskListener
Returns:
A writer to receive details of the error. Not null.

error

public PrintWriter error(String format,
                         Object... args)
Description copied from interface: TaskListener
Formatter.format(String, Object[]) version of TaskListener.error(String).

Specified by:
error in interface TaskListener

fatalError

public PrintWriter fatalError(String msg)
Description copied from interface: TaskListener
A fatal error in the build.

Specified by:
fatalError in interface TaskListener
Returns:
A writer to receive details of the error. Not null.

fatalError

public PrintWriter fatalError(String format,
                              Object... args)
Description copied from interface: TaskListener
Formatter.format(String, Object[]) version of TaskListener.fatalError(String).

Specified by:
fatalError in interface TaskListener

annotate

public void annotate(ConsoleNote ann)
              throws IOException
Description copied from interface: TaskListener
Annotates the current position in the output log by using the given annotation. If the implementation doesn't support annotated output log, this method might be no-op.

Specified by:
annotate in interface TaskListener
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

closeQuietly

public void closeQuietly()
Closes this listener and swallows any exceptions, if raised.

Since:
1.349


Copyright © 2004-2013. All Rights Reserved.