Package net.rim.device.api.io.http

Examples of net.rim.device.api.io.http.MDSPushInputStream


     * @param input
     *            the InputStream for this message.
     * @return an implementation of PushInputStream.
     */
    private PushInputStream createPushInputStream( StreamConnection stream, InputStream input ) {
        PushInputStream result = new MDSPushInputStream( (HttpServerConnection) stream, input );
        return result;
    }
View Full Code Here


                Thread.yield();
            }

            StreamConnection stream = null;
            InputStream input = null;
            MDSPushInputStream pushInputStream = null;

            try {
                _notify =
                        (StreamConnectionNotifier) Connector.open(URL
                                + ";deviceside=false");

                while (!_stop) {
                    // NOTE: the following will block until data is received
                    stream = _notify.acceptAndOpen();

                    try {
                        input = stream.openInputStream();
                        pushInputStream =
                                new MDSPushInputStream(
                                        (HttpServerConnection) stream, input);

                        // Extract the data from the input stream
                        final DataBuffer db = new DataBuffer();
                        byte[] data = new byte[CHUNK_SIZE];
                        int chunk = 0;

                        while (-1 != (chunk = input.read(data))) {
                            db.write(data, 0, chunk);
                        }

                        updateMessage(data);

                        // If the push server has application level reliabilty
                        // enabled, this method call will acknowledge receipt
                        // of the push.
                        pushInputStream.accept();

                        data = db.getArray();
                    } catch (final IOException ioe) {
                        // A problem occurred with the input stream , however,
                        // the original
View Full Code Here

TOP

Related Classes of net.rim.device.api.io.http.MDSPushInputStream

Copyright © 2018 www.massapicom. 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.