Slide 5.5: Fetching a page using a StreamConnection
  Slide 5.7: Fetching a page using an HttpConnection
  Home


Fetching a Page Using a StreamConnection (Cont.)


StreamConnection c = null;
The interface javax.microedition.io.StreamConnection defines the capabilities that a stream connection must have.

InputStream s = null;
The class java.io.InputStream is the superclass of all classes representing an input stream of bytes.

StringBuffer b = new StringBuffer( );
The class java.lang.StringBuffer implements a mutable sequence of characters. A string buffer is like a String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls.

c = (StreamConnection) Connector.open( url ); s = c.openInputStream( );
The method public InputStream javax.microedition.io.InputConnection.openInputStream( ) throws IOException opens and returns an input stream for a connection.

System.out.println( b.toString( ) );
The method public String toString( ) converts to a string representing the data in this string buffer.