org.crsh.command
Class Pipe<C,P>

java.lang.Object
  extended by org.crsh.command.Pipe<C,P>
Type Parameters:
C - the consumed generic type
P - the produced generic type
All Implemented Interfaces:
Closeable, Flushable, Consumer<C>, Filter<C,P,InvocationContext<P>>, Producer<P,InvocationContext<P>>

public abstract class Pipe<C,P>
extends Object
implements Filter<C,P,InvocationContext<P>>

A command pipe.


Field Summary
protected  InvocationContext<P> context
          .
 
Constructor Summary
Pipe()
           
 
Method Summary
 void close()
          Close pipe.
 void flush()
          Flush pipe.
 Class<C> getConsumedType()
          Returns the class of the element generic type.
 Class<P> getProducedType()
          Returns the class of the produced type.
 boolean isPiped()
           
 void open()
          Open pipe.
 void open(InvocationContext<P> consumer)
          Open the producer with the specified consumer.
 void provide(C element)
          Extends the throw clause of the Consumer.provide(Object) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected InvocationContext<P> context
.

Constructor Detail

Pipe

public Pipe()
Method Detail

isPiped

public final boolean isPiped()

getProducedType

public final Class<P> getProducedType()
Description copied from interface: Producer
Returns the class of the produced type.

Specified by:
getProducedType in interface Producer<P,InvocationContext<P>>
Returns:
the produced type

getConsumedType

public final Class<C> getConsumedType()
Description copied from interface: Consumer
Returns the class of the element generic type.

Specified by:
getConsumedType in interface Consumer<C>
Returns:
the consumed type

open

public void open(InvocationContext<P> consumer)
Description copied from interface: Producer
Open the producer with the specified consumer.

Specified by:
open in interface Producer<P,InvocationContext<P>>
Parameters:
consumer - the consumer

open

public void open()
          throws ScriptException
Open pipe.

Throws:
ScriptException

provide

public void provide(C element)
             throws ScriptException,
                    IOException
Extends the throw clause of the Consumer.provide(Object) method.

Specified by:
provide in interface Consumer<C>
Parameters:
element - the provided element
Throws:
ScriptException - any script exception
IOException - any io exception

flush

public void flush()
           throws ScriptException,
                  IOException
Flush pipe.

Specified by:
flush in interface Flushable
Throws:
ScriptException - any script exception
IOException - any io exception

close

public void close()
           throws ScriptException,
                  IOException
Close pipe.

Specified by:
close in interface Closeable
Specified by:
close in interface Producer<P,InvocationContext<P>>
Throws:
ScriptException - any script exception
IOException - any io exception


Copyright © 2014 eXo Platform SAS. All Rights Reserved.