Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Java by registered user webref ( 14 years ago )
public boolean fileRead(String path, byte[] data ) {
        Connection conn = null;
        InputStream is = null;
        try {        
            conn = Connector.open(path, Connector.READ);
            FileConnection fc = (FileConnection)conn;
            if (!fc.exists())
                fc.create();
            else
                fc.truncate(0);
            is = fc.openInputStream();
            if (is.available() !=0)
                is.read(data);
            return true;
        }
        catch (Exception ie) {
            return false;
        }
        finally {
            try {
                if (conn != null)
                    conn.close();
                if (is != null)
                    is.close();
                    is.reset();
                destroyApp(true);
                notifyDestroyed();
            } catch (Exception ioerr) {
            return false;
            }
        }
    }

 

Revise this Paste

Your Name: Code Language: