org.jmlspecs.eclipse.jdt.ui
Class Console.StreamToConsole

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jmlspecs.eclipse.jdt.ui.Console.StreamToConsole
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Enclosing class:
Console

public static class Console.StreamToConsole
extends java.io.OutputStream

This class is an OutputStream that, when written to, writes the data to the Eclipse Console supplied in the constructor. This requires converting from the byte data written to the Stream into character data that is written to a MessageConsole; thus a specific Charset is required.

Author:
David R. Cok

Constructor Summary
Console.StreamToConsole(org.eclipse.ui.console.MessageConsoleStream console)
          Constructs an OutputStream that is connected to the given console.
 
Method Summary
 void close()
           
 void flush()
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Console.StreamToConsole

public Console.StreamToConsole(org.eclipse.ui.console.MessageConsoleStream console)
Constructs an OutputStream that is connected to the given console.

Parameters:
console - The console to write to via the OutputStream
Method Detail

write

public void write(int b)
Specified by:
write in class java.io.OutputStream

write

public void write(byte[] b,
                  int off,
                  int len)
Overrides:
write in class java.io.OutputStream

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

close

public void close()
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream