Package javax.microedition.io

Examples of javax.microedition.io.InputConnection


            // Determine protocol
            String protocol = request.getProtocol();

            bfScreen.getPageManager().setGoingBackSafe( false );
            InputConnection ic = null;
            try {
                if( bfScreen.getCacheManager() != null && bfScreen.getCacheManager().isRequestCacheable( request ) ) {
                    if( bfScreen.getCacheManager().hasCache( request.getURL() )
                            && !bfScreen.getCacheManager().hasCacheExpired( request.getURL() ) ) {
                        ic = bfScreen.getCacheManager().getCache( request.getURL() );
View Full Code Here


            openWithBrowser( request );
            return null;
        }

        BrowserFieldScreen bfScreen = ( (BrowserFieldScreen) _browserField.getScreen() );
        InputConnection ic = null;
        if( bfScreen.getCacheManager() != null && bfScreen.getCacheManager().isRequestCacheable( request ) ) {
            if( bfScreen.getCacheManager().hasCache( request.getURL() )
                    && !bfScreen.getCacheManager().hasCacheExpired( request.getURL() ) ) {
                ic = bfScreen.getCacheManager().getCache( request.getURL() );
            } else {
View Full Code Here

        BrowserField browserField = (BrowserField) BBMPlatformExtension._browserField.get();
        final BrowserFieldConfig bfConfig = browserField.getConfig();
        final BrowserFieldController bfController =
                (BrowserFieldController) bfConfig.getProperty(BrowserFieldConfig.CONTROLLER);
       
        InputConnection ic = null;
        DataInputStream is = null;
       
        try {
            final BrowserFieldRequest bfReq = new BrowserFieldRequest(uri);
            ic = bfController.handleResourceRequest(bfReq);
            is = ic.openDataInputStream();
           
            final ByteVector bmpBytes = new ByteVector();
            try {
                while(true) {
                    bmpBytes.addElement(is.readByte());
                }
            } catch(EOFException e) {
            }
           
            return bmpBytes.getArray();
        } finally {
            try {
                ic.close();
            } catch(Exception e) { }
           
            try {
                is.close();
            } catch(Exception e) { }
View Full Code Here

    /**
     * @see ScriptableFunctionBase#execute(Object, Object[])
     */
    public Object execute( Object thiz, Object[] args ) throws Exception {
        DataInputStream dis = null;
        InputConnection ic = null;

        try {
            BrowserFieldRequest bfr = new BrowserFieldRequest( args[ 0 ].toString() );
            ic = ((BrowserFieldController)_weakReferenceBrwoserFieldController.get()).handleResourceRequest( bfr );

            dis = ic.openDataInputStream();
            ByteVector vc = new ByteVector();

            for( int b = dis.read(); b != -1; b = dis.read() ) {
                vc.addElement( (byte) b );
            }

            // An application could have multiple entry points and each entry point has its own icon.
            // We need to update icons for all entry points to be the same one.
            Bitmap image = Bitmap.createBitmapFromBytes( vc.getArray(), 0, vc.size(), 1 );
            ApplicationDescriptor current = ApplicationDescriptor.currentApplicationDescriptor();
            int moduleHandle = current.getModuleHandle();
            ApplicationDescriptor[] descriptors = CodeModuleManager.getApplicationDescriptors( moduleHandle );
           
            if( args.length == 1 || !( (Boolean) args[ 1 ] ).booleanValue() ) {
                for( int i = 0; i < descriptors.length; i++ ) {
                    HomeScreen.updateIcon( image, descriptors[ i ] );
                }
            } else {
                for( int i = 0; i < descriptors.length; i++ ) {
                    HomeScreen.setRolloverIcon( image, descriptors[ i ] );
                }
            }
        } finally {
            try {
                if( dis != null ) {
                    dis.close();
                }
                if( ic != null ) {
                    ic.close();
                }
            } catch( IOException e ) {
            }
        }

View Full Code Here

    /**
     * {@inheritDoc}
     */
    public InputStream openInputStream() throws IOException
    {
        final InputConnection connection = (InputConnection)Connector.open( PREFIX + path_, Connector.READ );
        final InputStream stream = connection.openInputStream();
        connection.close();
        return stream;
    }
View Full Code Here

                    os.write(getCommand.getBytes());
                    os.flush();
                }

                // Get InputConnection and read the server's response
                final InputConnection inputConn = (InputConnection) connection;
                is = inputConn.openInputStream();
                final byte[] data =
                        net.rim.device.api.io.IOUtilities.streamToBytes(is);
                result = new String(data);
                is.close();
View Full Code Here

TOP

Related Classes of javax.microedition.io.InputConnection

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.