Package javax.microedition.io

Examples of javax.microedition.io.HttpConnection.openDataInputStream()


          if (HttpConnection.POST == _method) {
            os = hc.openDataOutputStream();
            os.write(params.getBytes());
          }
               
                is = hc.openDataInputStream();
                int responseCode = hc.getResponseCode();
               
          if (responseCode != HttpConnection.HTTP_OK) {
            Logger.error("Response code: " +responseCode);
            callErrorCallback(new Object[] { "Server Error", new Integer(responseCode) });
View Full Code Here


               
                os.write(endBoundary.getBytes());
                os.flush();
                os.close();
               
                is = hc.openDataInputStream();
                int responseCode = hc.getResponseCode();
               
          if (responseCode != HttpConnection.HTTP_OK) {
            Logger.error("Response code: " +responseCode);
            callErrorCallback(new Object[] { "Server Error", new Integer(responseCode) });
View Full Code Here

    private String getGoogleTokenViaMyServer(String userName, String passwd) {
        String first = "email="+userName+"&pass="+passwd;
        try {
            HttpConnection c = (HttpConnection) Connector.open(MY_SERVER+first);
            log.addMessage("Connecting to help server...");
            DataInputStream dis = c.openDataInputStream();
            String str = readLine(dis);
            if(!str.equals("")&&!ended) {
                dis.close();
                c.close();
                return str;
View Full Code Here

            /**Caution: os.flush() is controversial. It may create unexpected behavior
            on certain mobile devices. Try it out for your mobile device **/
            //os.flush();
            // Read Response from the Server
            StringBuffer sb = new StringBuffer();
            is = httpConn.openDataInputStream();
            int chr;
            while ((chr = is.read()) != -1) {
                sb.append((char) chr);
            }
            ret=sb.toString().indexOf("true")>-1;
View Full Code Here

               
                outputStream = httpCon.openDataOutputStream();
                outputStream.write(dataToSend);
                outputStream.flush();
               
                inputStream = httpCon.openDataInputStream();
               
                int size = (int)httpCon.getLength();//in an HTTP connection it has to be the value of the
                                                    //'content-length' header field. When not known, -1
               
                b = new StringBuffer(size >= 0 ? (int)size : 4096);
View Full Code Here

      addVar("readyState", READY_STATE_LOADING);
      addVar("status", new Double(c.getResponseCode()));

      int len = (int) c.getLength();
      dis = c.openDataInputStream();
      if (len > 0) {
        this.responseBody = new byte[len];
        dis.readFully(this.responseBody);
        addVar("resBytes", this.responseBody);
        for (int i = 0; i < this.responseBody.length; i++) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.