Package javax.microedition.io.file

Examples of javax.microedition.io.file.FileConnection.openDataInputStream()


      byte[] data = null;
      FileConnection fconn = null;
      DataInputStream is = null;
      try{
      fconn = (FileConnection) Connector.open(fName, Connector.READ_WRITE);
      is = fconn.openDataInputStream();            
      data = IOUtilities.streamToBytes(is);
          is.close();
          fconn.close();
      } catch (Exception ex) {
         Dialog.inform("Error in file path: " + ex.toString());
View Full Code Here


        String name = con.getName();
        String mimeType = MIMETypeAssociations.getMIMEType( name );

        int size = (int) con.fileSize();
        byte[] data = new byte[ size ];
        DataInputStream dis = con.openDataInputStream();
        dis.read( data, 0, size );
        close( dis );
        close( con );

        String encoding = getEncoding( data );
View Full Code Here

                            throw new IOException(T._("Unable to open resource ") + path);
                    } else {
                        FileConnection fc = (FileConnection) Connector.open("file://localhost/" + path);
                        if (!fc.exists())
                            throw new IOException(T._("File ") + path + T._(" doesn't exists!"));
                        is = fc.openDataInputStream();
                    }

                    // Read and parse file in main thread. It's running too slow in parallel!
                    //display.callSerially(new Runnable() {
                        //public void run() {
View Full Code Here

                            throw new IOException(T._("Unable to open resource ") + path);
                    } else {
                        FileConnection fc = (FileConnection) Connector.open("file://localhost/" + path);
                        if (!fc.exists())
                            throw new IOException(T._("File ") + path + T._(" doesn't exists!"));
                        is = fc.openDataInputStream();
                    }

                    // Read and parse file in main thread. It's running too slow in parallel!
                    //display.callSerially(new Runnable() {
                        //public void run() {
View Full Code Here

                            throw new IOException(T._("Unable to open resource ") + path);
                    } else {
                        FileConnection fc = (FileConnection) Connector.open("file://localhost/" + path);
                        if (!fc.exists())
                            throw new IOException(T._("File ") + path + T._(" doesn't exists!"));
                        is = fc.openDataInputStream();
                    }

                    // Read and parse file in main thread. It's running too slow in parallel!
                    //display.callSerially(new Runnable() {
                        //public void run() {
View Full Code Here

                            throw new IOException(T._("Unable to open resource ") + path);
                    } else {
                        FileConnection fc = (FileConnection) Connector.open("file://localhost/" + path);
                        if (!fc.exists())
                            throw new IOException(T._("File ") + path + T._(" doesn't exists!"));
                        is = fc.openDataInputStream();
                    }

                    // Read and parse file in main thread. It's running too slow in parallel!
                    display.callSerially(new Runnable() {
                        public void run() {
View Full Code Here

    private String readHelpText(String filename)
    {
      try
      {
        FileConnection fc = (FileConnection) Connector.open( filename, Connector.READ);
        InputStream is = fc.openDataInputStream();
        StringBuffer sb = new StringBuffer();
        int chr;
        // Read until the end of the stream     
        while ((chr = is.read()) != -1)
            sb.append((char) chr);
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.