import javax.microedition.lcdui.*; import javax.microedition.midlet.*; import javax.microedition.io.*; import java.io.*; import radchuk.Translit; /* Author: wRadchuk * * * * * * * * * * * */ public class Main extends MIDlet { public static Main main; //ссылка должна быть статичной public Display d; public Form f; public String string; public HttpConnection net; public DataInputStream dis; public Translit t; public Main() { main=this; //создание ссылки try { net = (HttpConnection)Connector.open("http://w-radchuk.tk/CEPBEP/user.php?id=2&id1=2"); dis = net.openDataInputStream(); while(true) { int i = dis.read(); if(i == -1) break; else string = string + ( char ) i; } dis.close(); net.close(); }catch(Exception e){} t = new Translit(); d = Display.getDisplay(this); f = new Form("Network"); f.append("Encode: " +t.encode(string)); f.append("\n"); f.append("Decode: " +t.decode(string)); } public void startApp(){ d.setCurrent(f); } public void pauseApp(){} public void destroyApp(boolean f){} }