DCT Lightfoot v3 API specification

com.dctl.j2me.io
Class SwitchableOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--com.dctl.j2me.io.SwitchableOutputStream
All Implemented Interfaces:
Lockable, Writable

public class SwitchableOutputStream
extends OutputStream
implements Lockable

A switchable output stream can be used to dynamically reconfigure output streams at runtime without changing all the objects using the stream. This is ideally suited for debug streams, but can support other streams


Constructor Summary
SwitchableOutputStream()
           
 
Method Summary
 void close()
          Close the stream.
 void flush()
          Flush the stream.
 void lock()
          Lock the stream.
 void setStream(OutputStream out)
          Set the stream to use
 void unlock()
          Unlock the stream.
 void write(byte[] buf)
          Write an array of bytes to the stream
 void write(byte[] buf, int off, int len)
          Write an array of bytes to the stream
 void write(int b)
          Write a byte to the stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwitchableOutputStream

public SwitchableOutputStream()
Method Detail

setStream

public void setStream(OutputStream out)
Set the stream to use

Parameters:
out - The stream to use

lock

public void lock()
Lock the stream. This blocks until the lock is complete

Specified by:
lock in interface Lockable

unlock

public void unlock()
Unlock the stream. This unlocks the stream

Specified by:
unlock in interface Lockable

close

public void close()
           throws IOException
Close the stream. This closes the sub level stream

Overrides:
close in class OutputStream
Throws:
IOException - if there is an IO error

flush

public void flush()
           throws IOException
Flush the stream.

Overrides:
flush in class OutputStream
Throws:
IOException - if there is an IO error

write

public void write(byte[] buf)
           throws IOException
Write an array of bytes to the stream

Overrides:
write in class OutputStream
Parameters:
buf - The buffer to write
Throws:
IOException - if there is an IO error

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws IOException
Write an array of bytes to the stream

Specified by:
write in interface Writable
Overrides:
write in class OutputStream
Parameters:
buf - The buffer to write
off - The offset in the buffer
len - The length in the buffer
Throws:
IOException - if there is an IO error

write

public void write(int b)
           throws IOException
Write a byte to the stream

Specified by:
write in interface Writable
Specified by:
write in class OutputStream
Parameters:
b - The byte to write
Throws:
IOException - if there is an IO error

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification