fr.gedeon.telnetservice.util
Class VT100PrintStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by fr.gedeon.telnetservice.util.AbstractPrintStream
                  extended by fr.gedeon.telnetservice.util.VT100PrintStream
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class VT100PrintStream
extends AbstractPrintStream

Provides a way to apply a VT100 style to all output that goes through it. It basically writes the style provided on construction before each output and then resets the style after it.
For example, to make all output have red background and bold white foreground text (e.g. for error output):

   VT100PrintStream error = new VT100PrintStream(new byte[][] {
     OutputFormatVT100Constants.ATTRS_BACK_RED,
     OutputFormatVT100Constants.ATTRS_FORE_WHITE,
     OutputFormatVT100Constants.STYLE_BOLD
   }, sessionState.getSession().getConsoleDelegate().getConsoleOutputStream(), true);
 
For more on how to compose VT100 style please refer to OutputFormatVT100Constants.

See Also:
OutputFormatVT100Constants, AbstractPrintStream

Field Summary
protected  byte[][] styleAttributes
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
VT100PrintStream(byte[][] style, File file)
           
VT100PrintStream(byte[][] style, File file, String csn)
           
VT100PrintStream(byte[][] style, OutputStream out)
           
VT100PrintStream(byte[][] style, OutputStream out, boolean autoFlush)
           
VT100PrintStream(byte[][] style, OutputStream out, boolean autoFlush, String encoding)
           
VT100PrintStream(byte[][] style, String fileName)
           
VT100PrintStream(byte[][] style, String fileName, String csn)
           
 
Method Summary
 void write(byte[] buf, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class fr.gedeon.telnetservice.util.AbstractPrintStream
_write, _write
 
Methods inherited from class java.io.PrintStream
append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

styleAttributes

protected byte[][] styleAttributes
Constructor Detail

VT100PrintStream

public VT100PrintStream(byte[][] style,
                        File file,
                        String csn)
                 throws FileNotFoundException,
                        UnsupportedEncodingException
Throws:
FileNotFoundException
UnsupportedEncodingException

VT100PrintStream

public VT100PrintStream(byte[][] style,
                        File file)
                 throws FileNotFoundException
Throws:
FileNotFoundException

VT100PrintStream

public VT100PrintStream(byte[][] style,
                        OutputStream out,
                        boolean autoFlush,
                        String encoding)
                 throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

VT100PrintStream

public VT100PrintStream(byte[][] style,
                        OutputStream out,
                        boolean autoFlush)

VT100PrintStream

public VT100PrintStream(byte[][] style,
                        OutputStream out)

VT100PrintStream

public VT100PrintStream(byte[][] style,
                        String fileName,
                        String csn)
                 throws FileNotFoundException,
                        UnsupportedEncodingException
Throws:
FileNotFoundException
UnsupportedEncodingException

VT100PrintStream

public VT100PrintStream(byte[][] style,
                        String fileName)
                 throws FileNotFoundException
Throws:
FileNotFoundException
Method Detail

write

public void write(int b)
Specified by:
write in class AbstractPrintStream

write

public void write(byte[] buf,
                  int off,
                  int len)
Specified by:
write in class AbstractPrintStream


Copyright © 2008. All Rights Reserved.