org.crsh.command.pipeline
Class ToChunkPipe<C,CONS extends CommandContext<? super Chunk>>

java.lang.Object
  extended by org.crsh.command.pipeline.AbstractPipe<C,Chunk,CONS>
      extended by org.crsh.command.pipeline.ToChunkPipe<C,CONS>
All Implemented Interfaces:
Closeable, Flushable, CommandContext<C>, RuntimeContext, Consumer<C>, Producer<Chunk,CONS>, InteractionContext, ScreenContext

public class ToChunkPipe<C,CONS extends CommandContext<? super Chunk>>
extends AbstractPipe<C,Chunk,CONS>

Author:
Julien Viet

Field Summary
private  ChunkAdapter adapter
          .
private  Class<C> consumedType
          .
 
Fields inherited from class org.crsh.command.pipeline.AbstractPipe
consumer, piped
 
Constructor Summary
ToChunkPipe(Class<C> consumedType, boolean piped)
           
 
Method Summary
 void close()
          Close the producer.
 void flush()
           
 Class<C> getConsumedType()
          Returns the class of the element generic type.
 Class<Chunk> getProducedType()
          Returns the class of the produced type.
 void open(CONS consumer)
          Open the producer with the specified consumer.
 void provide(C element)
          Provide an element.
 void write(Chunk chunk)
          Write a chunk to the screen.
 
Methods inherited from class org.crsh.command.pipeline.AbstractPipe
getAttributes, getHeight, getProperty, getSession, getWidth, isPiped, readLine, releaseAlternateBuffer, takeAlternateBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adapter

private ChunkAdapter adapter
.


consumedType

private Class<C> consumedType
.

Constructor Detail

ToChunkPipe

public ToChunkPipe(Class<C> consumedType,
                   boolean piped)
Method Detail

open

public void open(CONS consumer)
Description copied from interface: Producer
Open the producer with the specified consumer.

Specified by:
open in interface Producer<Chunk,CONS extends CommandContext<? super Chunk>>
Overrides:
open in class AbstractPipe<C,Chunk,CONS extends CommandContext<? super Chunk>>
Parameters:
consumer - the consumer

provide

public void provide(C element)
             throws IOException
Description copied from interface: Consumer
Provide an element.

Parameters:
element - the provided element
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class AbstractPipe<C,Chunk,CONS extends CommandContext<? super Chunk>>
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: Producer
Close the producer.

Specified by:
close in interface Closeable
Specified by:
close in interface Producer<Chunk,CONS extends CommandContext<? super Chunk>>
Overrides:
close in class AbstractPipe<C,Chunk,CONS extends CommandContext<? super Chunk>>
Throws:
IOException - any io exception

write

public void write(Chunk chunk)
           throws IOException
Description copied from interface: ScreenContext
Write a chunk to the screen.

Parameters:
chunk - the chunk
Throws:
IOException - any io exception

getProducedType

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

Returns:
the produced type

getConsumedType

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

Returns:
the consumed type


Copyright © 2013 eXo Platform SAS. All Rights Reserved.