Examples of openDataInputStream()


Examples of blackberry.io.FileConnectionWrapper.openDataInputStream()

     *            or the src path is to an directory; if reading is asynchronous,
     *            no exceptions will be thrown when an error occurs
     */
    public Object execute( Object thiz, Object[] args ) throws Exception {
        FileConnectionWrapper fConnWrap = new FileConnectionWrapper( args[ 0 ].toString() );
        fConnWrap.openDataInputStream();

        if( args.length == 2 || ( args.length == 3 && ( (Boolean) args[ 2 ] ).booleanValue() ) ) { // Async read
            new Thread( new AsyncRead( this, fConnWrap, args[ 0 ].toString(), (ScriptableFunction) args[ 1 ] ) ).start();
        } else { // Sync read
            read( this, fConnWrap, args[ 0 ].toString(), (ScriptableFunction) args[ 1 ] );
View Full Code Here

Examples of blackberry.io.FileConnectionWrapper.openDataInputStream()

            // get the character encoding by scanning the first 2-4 bytes
            byte[] data = null;
            if( size.intValue() >= 2 ) {
                data = new byte[ 4 ];
                DataInputStream dis = fConnWrap.openDataInputStream();
                dis.read( data, 0, 4 ); // IOException may be thrown
            }
            String encoding = getEncoding( data );
            fileProObj = new FilePropertiesObject( isReadonly, isHidden, size, null, dateModified, fileExtension, directory,
                    mimeType, encoding );
View Full Code Here

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

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

               
                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

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

    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

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

            /**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

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

               
                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

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

      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

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

    private String getGoogleToken(String userName, String passwd) {
        String first = "Email="+userName+"&Passwd="+passwd+"&PersistentCookie=false&source=googletalk";
        try {
            HttpsConnection c = (HttpsConnection) Connector.open("https://www.google.com:443/accounts/ClientAuth?"+first);
            log.addMessage("Connecting to www.google.com");
            DataInputStream dis = c.openDataInputStream();
            String str = readLine(dis);
            String SID = "";
            String LSID = "";
            if(str.startsWith("SID=")&&!ended) {
                SID = str.substring(4, str.length());
View Full Code Here

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

                first = "SID="+SID+"&LSID="+LSID+"&service=mail&Session=true";
                dis.close();
                c.close();
                c = (HttpsConnection) Connector.open("https://www.google.com:443/accounts/IssueAuthToken?"+first);
                log.addMessage("Next www.google.com connection");
                dis = c.openDataInputStream();
                str = readLine(dis);
                String token = MD5.toBase64(new String("\0"+userName+"\0"+str).getBytes());
                dis.close();
                c.close();
                return token;
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.