com.github.croesch.micro_debug.mic1.io
Class Output

java.lang.Object
  extended by com.github.croesch.micro_debug.mic1.io.Output

public final class Output
extends Object

This class represents the connection to the output of the mic1-processor. It can buffer the output until it prints it to its PrintStream or put each single byte to its PrintStream.

Since:
Date: Nov 26, 2011
Author:
croesch

Method Summary
static void flush()
          Empties the buffer and writes everything to the PrintStream
static boolean isBuffered()
          Returns whether this output is buffered or not.
static void print(byte val)
          Prints a single byte to the PrintStream.
static void reset()
          Empties the internal buffer, so that any contents printed into the buffer will be lost.
static void setBuffered(boolean buf)
          Determines if any output should be buffered before it's written to the PrintStream or not.
static void setOut(PrintStream newOut)
          Sets the PrintStream to write the data to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setBuffered

public static void setBuffered(boolean buf)
Determines if any output should be buffered before it's written to the PrintStream or not. If output is buffered, this class will wait writing the bytes to the PrintStream until a line terminating character is written to the output. If it's not buffered, each byte will be directly written to the PrintStream.
Note: The output'll be flushed when invoking this method.

Parameters:
buf - true, if the output should be buffered
Since:
Date: Nov 26, 2011
See Also:
flush()

isBuffered

public static boolean isBuffered()
Returns whether this output is buffered or not. See setBuffered(boolean) for more information.

Returns:
true, if the output is buffered
Since:
Date: Dec 3, 2011
See Also:
setBuffered(boolean)

print

public static void print(byte val)
Prints a single byte to the PrintStream. If the output is buffered, the output will be flushed, when print(byte) is called with a LF.

Parameters:
val - the byte to write to the PrintStream
Since:
Date: Nov 26, 2011

flush

public static void flush()
Empties the buffer and writes everything to the PrintStream

Since:
Date: Nov 26, 2011

reset

public static void reset()
Empties the internal buffer, so that any contents printed into the buffer will be lost.

Since:
Date: Feb 10, 2012

setOut

public static void setOut(PrintStream newOut)
Sets the PrintStream to write the data to.

Parameters:
newOut - the new PrintStream, mustn't be null
Since:
Date: Nov 26, 2011


Copyright © 2012. All Rights Reserved.