jline
Class ConsoleReaderInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by jline.ConsoleReaderInputStream
All Implemented Interfaces:
java.io.Closeable

public class ConsoleReaderInputStream
extends java.io.InputStream

An InputStream implementation that wraps a ConsoleReader. It is useful for setting up the System.in for a generic console.

Author:
Marc Prud'hommeaux

Constructor Summary
ConsoleReaderInputStream(ConsoleReader reader)
           
 
Method Summary
 int available()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
static void restoreIn()
          Restore the original System.in input stream.
static void setIn()
           
static void setIn(ConsoleReader reader)
           
 void setPrompt(java.lang.String prompt)
          Sets the prompt for this input stream.
 
Methods inherited from class java.io.InputStream
close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsoleReaderInputStream

public ConsoleReaderInputStream(ConsoleReader reader)
Method Detail

setIn

public static void setIn()
                  throws java.io.IOException
Throws:
java.io.IOException

setIn

public static void setIn(ConsoleReader reader)

restoreIn

public static void restoreIn()
Restore the original System.in input stream.


available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.available()

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read()

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read(byte[], int, int)

setPrompt

public void setPrompt(java.lang.String prompt)
Sets the prompt for this input stream. This can be changed at any point and the prompt for subsequent lines will reflect the change.

Parameters:
p - the new prompt


Copyright © 2002-2007 Open World Ltd. All Rights Reserved.