import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import java.io.*;
public class Veebilugeja1 extends MIDlet {
  TextBox t1;
  public Veebilugeja1(){
   try{
    String aadress="http://localhost:8080/examples/servlet/Baasilooja3";
    InputStream sisse=Connector.openInputStream(aadress);
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    int arv=sisse.read();
    while(arv!=-1){
      baos.write(arv);
      arv=sisse.read();
    }
    byte[] b=baos.toByteArray();   
    String tekst=new String(b);
    t1=new TextBox("Andmed", tekst, tekst.length(), TextField.ANY);
    Display.getDisplay(this).setCurrent(t1);
   }catch(Exception e){
     e.printStackTrace();
   }
  }
  protected void startApp( ) throws MIDletStateChangeException{}
  protected void pauseApp( ){}
  protected void destroyApp( boolean p1 ) throws MIDletStateChangeException{}
}
