SunSPOT API V4.0


com.sun.spot.io.j2me.socket
Class SocketProtocolInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.sun.spot.io.j2me.socket.SocketProtocolInputStream

public class SocketProtocolInputStream
extends InputStream

Socket specific InputSteam. This class handles the passing of protocol information while remaining seamless to the user.

Author:
Martin Morissette

Field Summary
static int CONNECTION_CLOSE
           
static int END_OF_MSG
           
static int ESCAPE_CHAR
           
static int IOEXCEPTION
           
 
Constructor Summary
SocketProtocolInputStream(InputStream in)
          Create the input stream from another InputStream.
 
Method Summary
 int available()
          Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
 void close()
          Close the InputStream.
 int read()
          Read data from the stream.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ESCAPE_CHAR

public static final int ESCAPE_CHAR
See Also:
Constant Field Values

CONNECTION_CLOSE

public static final int CONNECTION_CLOSE
See Also:
Constant Field Values

IOEXCEPTION

public static final int IOEXCEPTION
See Also:
Constant Field Values

END_OF_MSG

public static final int END_OF_MSG
See Also:
Constant Field Values
Constructor Detail

SocketProtocolInputStream

public SocketProtocolInputStream(InputStream in)
Create the input stream from another InputStream.

Parameters:
in - InputStream to be used
Method Detail

read

public int read()
         throws IOException
Read data from the stream.

Specified by:
read in class InputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.

available

public int available()
              throws IOException
Description copied from class: InputStream
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread.

The available method for class InputStream always returns 0.

This method should be overridden by subclasses.

Overrides:
available in class InputStream
Returns:
the number of bytes that can be read from this input stream without blocking.
Throws:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
Close the InputStream.

Overrides:
close in class InputStream
Throws:
IOException - if an I/O error occurs.

SunSPOT API V4.0


Copyright © 2006-2008 Sun Microsystems, Inc. All Rights Reserved.