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

java.lang.Object
  extended by org.crsh.shell.impl.command.Pipe<C,P>
All Implemented Interfaces:
Closeable, Flushable, Consumer<C>, Filter<C,P,InteractionContext<P>>, Producer<P,InteractionContext<P>>, InteractionContext<C>, ScreenContext<C>
Direct Known Subclasses:
Pipe.Chunkizer, Pipe.Invoker, Pipe.Sink

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

Author:
Julien Viet

Nested Class Summary
(package private) static class Pipe.Chunkizer
           
(package private) static class Pipe.Invoker<C,P>
          A pipe filter that invokes a command through a CommandInvoker.
(package private) static class Pipe.Sink<P>
           
 
Field Summary
protected  InteractionContext<P> context
          .
 
Constructor Summary
Pipe()
           
 
Method Summary
 int getHeight()
          Returns the screen height in chars.
 String getProperty(String propertyName)
          Returns a generic property, usually this property is resolved by the shell client.
 int getWidth()
          Returns the screen width in chars.
 String readLine(String msg, boolean echo)
          Display a message and read a line on the console.
 boolean releaseAlternateBuffer()
          Release control of the alternate buffer.
 boolean takeAlternateBuffer()
          Take control of the alternate buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.crsh.io.Producer
close, getProducedType, open, setPiped
 
Methods inherited from interface org.crsh.io.Consumer
getConsumedType, provide
 
Methods inherited from interface java.io.Flushable
flush
 

Field Detail

context

protected InteractionContext<P> context
.

Constructor Detail

Pipe

Pipe()
Method Detail

takeAlternateBuffer

public final boolean takeAlternateBuffer()
                                  throws IOException
Description copied from interface: InteractionContext
Take control of the alternate buffer. When the alternate buffer is already used nothing happens. The buffer switch should occur when then Flushable.flush() method is invoked.

Specified by:
takeAlternateBuffer in interface InteractionContext<C>
Returns:
true if the alternate buffer is shown
Throws:
IOException

releaseAlternateBuffer

public final boolean releaseAlternateBuffer()
                                     throws IOException
Description copied from interface: InteractionContext
Release control of the alternate buffer. When the normal buffer is already used nothing happens. The buffer switch should occur when then Flushable.flush() method is invoked.

Specified by:
releaseAlternateBuffer in interface InteractionContext<C>
Returns:
true if the usual buffer is shown
Throws:
IOException

getProperty

public final String getProperty(String propertyName)
Description copied from interface: InteractionContext
Returns a generic property, usually this property is resolved by the shell client.

Specified by:
getProperty in interface InteractionContext<C>
Parameters:
propertyName - the property name
Returns:
the property value

readLine

public final String readLine(String msg,
                             boolean echo)
Description copied from interface: InteractionContext
Display a message and read a line on the console. If no line can be read then null is returned.

Specified by:
readLine in interface InteractionContext<C>
Parameters:
msg - the message to display before reading a line
echo - wether or not the line read should be echoed when typing
Returns:
the line read

getWidth

public final int getWidth()
Description copied from interface: ScreenContext
Returns the screen width in chars. When the value is not positive it means the value could not be determined.

Specified by:
getWidth in interface ScreenContext<C>
Returns:
the term width

getHeight

public final int getHeight()
Description copied from interface: ScreenContext
Returns the screen height in chars. When the value is not positive it means the value could not be determined.

Specified by:
getHeight in interface ScreenContext<C>
Returns:
the term height


Copyright © 2013 eXo Platform SAS. All Rights Reserved.