SunSPOT host API V3.0


com.sun.spot.io.j2me.remoteprinting
Class RemotePrintOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.sun.spot.io.j2me.remoteprinting.RemotePrintOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class RemotePrintOutputStream
extends OutputStream

Helper class for "remoteprint:" connections. This class provides an OutputStream that will stream data to another Spot using a radio connection. This class is needed to automatically flush the radio stream whenever a newline is printed. It also reports back to the RemotePrinting client if the connection is broken.

Author:
Ron Goldman

Constructor Summary
RemotePrintOutputStream(String address)
          Creates a new RemotePrintOutputStream piping its output to a new RadioOutputStream.
 
Method Summary
 void close()
          Close this OutputStream along with the underlying RadioOutputStream.
 void flush()
          Flush any characters in our buffer, sending them over the radio to the remote print server.
 void write(int arg0)
          Writes out a character, flushing the buffer if a newline.
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotePrintOutputStream

public RemotePrintOutputStream(String address)
Creates a new RemotePrintOutputStream piping its output to a new RadioOutputStream.

Parameters:
address - the IEEE radio address of the remote print server and the port to use
Method Detail

write

public void write(int arg0)
           throws IOException
Writes out a character, flushing the buffer if a newline.

Specified by:
write in class OutputStream
Parameters:
arg0 - the character to write to the remote print server
Throws:
IOException
See Also:
OutputStream.write(int)

flush

public void flush()
           throws IOException
Flush any characters in our buffer, sending them over the radio to the remote print server.

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException
See Also:
OutputStream.write(int)

close

public void close()
           throws IOException
Close this OutputStream along with the underlying RadioOutputStream.

Flushes any characters in the buffer before closing the OutputStream.

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException
See Also:
OutputStream.close()

SunSPOT host API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.