org.netbeans.modules.extexecution/2 1.25.1

org.netbeans.api.extexecution.input
Class LineProcessors

java.lang.Object
  extended by org.netbeans.api.extexecution.input.LineProcessors

public final class LineProcessors
extends Object

Factory methods for LineProcessor classes.

Note that main difference between InputProcessor and LineProcessor is that LineProcessor always process whole lines.

See Also:
InputProcessors.bridge(org.netbeans.api.extexecution.input.LineProcessor)

Method Summary
static LineProcessor patternWaiting(Pattern pattern, CountDownLatch latch)
          Returns the processor that will wait for the line matching the pattern, decreasing the latch when such line appears for the first time.
static LineProcessor printing(OutputWriter out, boolean resetEnabled)
          Returns the processor printing all lines passed for processing to the given output writer.
static LineProcessor printing(OutputWriter out, LineConvertor convertor, boolean resetEnabled)
          Returns the processor converting lines with convertor and printing the result to the given output writer.
static LineProcessor proxy(LineProcessor... processors)
          Returns the processor acting as a proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

proxy

@NonNull
public static LineProcessor proxy(@NonNull
                                          LineProcessor... processors)
Returns the processor acting as a proxy.

Any action taken on this processor is distributed to all processors passed as arguments in the same order as they were passed to this method.

Returned processor is not thread safe.

Parameters:
processors - processor to which the actions will be ditributed
Returns:
the processor acting as a proxy

printing

@NonNull
public static LineProcessor printing(@NonNull
                                             OutputWriter out,
                                             boolean resetEnabled)
Returns the processor printing all lines passed for processing to the given output writer.

Reset action on the returned processor resets the writer if it is enabled by passing true as resetEnabled. Processor closes the output writer on InputProcessor.close().

Returned processor is not thread safe.

Parameters:
out - where to print received lines
resetEnabled - determines whether the reset operation will work (will reset the writer if so)
Returns:
the processor printing all lines passed for processing to the given output writer

printing

@NonNull
public static LineProcessor printing(@NonNull
                                             OutputWriter out,
                                             @NullAllowed
                                             LineConvertor convertor,
                                             boolean resetEnabled)
Returns the processor converting lines with convertor and printing the result to the given output writer. If the covertor does not handle line passed to it (returning null) raw lines are printed.

Reset action on the returned processor resets the writer if it is enabled by passing true as resetEnabled. Processor closes the output writer on InputProcessor.close().

Returned processor is not thread safe.

Parameters:
out - where to print converted lines and characters
convertor - convertor converting the lines before printing, may be null
resetEnabled - determines whether the reset operation will work (will reset the writer if so)
Returns:
the processor converting the lines with convertor and printing the result to the given output writer
See Also:
LineConvertor

patternWaiting

@NonNull
public static LineProcessor patternWaiting(@NonNull
                                                   Pattern pattern,
                                                   @NonNull
                                                   CountDownLatch latch)
Returns the processor that will wait for the line matching the pattern, decreasing the latch when such line appears for the first time.

Reset action on the returned processor is noop.

Returned processor is thread safe.

Parameters:
pattern - pattern that line must match in order decrease the latch
latch - latch to decrease when the line matching the pattern appears for the first time
Returns:
the processor that will wait for the line matching the pattern, decreasing the latch when such line appears for the first time

org.netbeans.modules.extexecution/2 1.25.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.