com.metamatrix.script.shell
Class ReaderInterceptor

java.lang.Object
  extended by java.io.Reader
      extended by com.metamatrix.script.shell.ReaderInterceptor
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class ReaderInterceptor
extends java.io.Reader

This class used in conjunction with BeanShell, to hijack the System.in and write a wrapper on top it,so that any commands entered in its console be passed through this code before any thing else happens. This will let us write code such as "select * from foo" on the bean shell command line, and we can intercept and issue right beanshell command to execute the same.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
ReaderInterceptor(CustomParser parser, java.io.Writer logger)
           
ReaderInterceptor(java.io.Reader in, CustomParser parser, java.io.Writer logger)
           
 
Method Summary
 void close()
           
static void main(java.lang.String[] args)
           
 int read(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderInterceptor

public ReaderInterceptor(CustomParser parser,
                         java.io.Writer logger)

ReaderInterceptor

public ReaderInterceptor(java.io.Reader in,
                         CustomParser parser,
                         java.io.Writer logger)
Method Detail

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader
Throws:
java.io.IOException
Since:
4.3
See Also:
Reader.close()

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Specified by:
read in class java.io.Reader
Throws:
java.io.IOException
Since:
4.3
See Also:
Reader.read(char[], int, int)

main

public static void main(java.lang.String[] args)


Copyright © 2009. All Rights Reserved.