Package javax.microedition.io.file

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


        createFolders(_filePath);
       
                fc = (FileConnection)Connector.open(_filePath, Connector.READ_WRITE);
               
                if (!fc.exists()) {
                  fc.create();
                }
            } catch (Exception e) {
              errorBuffer = new StringBuffer("Unable to create file: ");
              errorBuffer.append(e.getMessage());
             
View Full Code Here


  {
    boolean result = false;
    try
    {
      FileConnection fconn = (FileConnection) Connector.open(filePath, Connector.READ_WRITE);
      if (!fconn.exists()) fconn.create();

      if (image != null)
      {
        PNGEncodedImage encodedImage = PNGEncodedImage.encode(image);
        byte[] imageBytes = encodedImage.getData();
View Full Code Here

                      fileName += (new Date()).getTime();                     
                      fconn.close();
                      fconn = (FileConnection)Connector.open(filePath+"//"+fileName+"."+fileExtension, Connector.READ_WRITE);
                    }
        
                    fconn.create();

                    OutputStream outputStream = fconn.openOutputStream();
                    EncodedImage encodedImage;
                    if(fileExtension.equals("jpg") || fileExtension.equals("jpeg")){
                      encodedImage = JPEGEncodedImage.encode(b, 100);
View Full Code Here

    public void saveFile(String fileName, byte[] data) throws IOException {
        final FileConnection conn = (FileConnection) Connector.open(rootPrefix + fileName);
        try {
            if (!conn.exists()) {
                conn.create();
            }
            final OutputStream out = conn.openOutputStream();
            try {
                out.write(data);
                out.flush();
View Full Code Here

                                FileConnection fileConn;
                                try {
                                    fileConn = (FileConnection) Connector.open(fileUrl, Connector.READ_WRITE);

                                    if (!fileConn.exists()) {
                                        fileConn.create();
                                    }
                                    DataOutputStream outputStream = fileConn.openDataOutputStream();
                                    outputStream.write(imageData);
                                    outputStream.close();
                                    fileConn.close();
View Full Code Here

        String fileName = "GpsLog_" + cal.get(Calendar.YEAR) + "-" + prefixWithZero(month) + "-" + prefixWithZero(day)
                + "_" + prefixWithZero(hour) + "." + prefixWithZero(minute) + "." + prefixWithZero(second) + ".txt";
        try {
            FileConnection fileConn = (FileConnection) Connector.open("file:///" + Options.getInstance().rootName
                    + IOTool.NMEA_LOGS_DIR + "/" + fileName, Connector.WRITE);
            fileConn.create();
            return fileConn.openDataOutputStream();
        } catch (IOException e) {
            CloudGps.setError(e);
        }
        return null;
View Full Code Here

                        .handleError( _errorCallback, new IllegalArgumentException( "'" + _path + "' already exists" ) );
                stop();
                return;
            }

            conn.create();

            // use output stream as it is shown in the sample
            _output = conn.openOutputStream();

            // Leave 44 bytes for the WAV header
View Full Code Here

            FileConnection fc = (FileConnection) Connector.open("file://localhost/"
                    + currDirName + newName);
            if (isDirectory) {
                fc.mkdir();
            } else {
                fc.create();
            }
            fc.close();
            showCurrDir();
        } catch (Exception e) {
            String s = T._("Can not create file ") + newName;
View Full Code Here

            FileConnection fc = (FileConnection) Connector.open("file://localhost/"
                    + currDirName + newName);
            if (isDirectory) {
                fc.mkdir();
            } else {
                fc.create();
            }
            fc.close();
            showCurrDir();
        } catch (Exception e) {
            String s = T._("Can not create file ") + newName;
View Full Code Here

            FileConnection fc = (FileConnection) Connector.open("file://localhost/"
                    + currDirName + newName);
            if (isDirectory) {
                fc.mkdir();
            } else {
                fc.create();
            }
            fc.close();
            showCurrDir();
        } catch (Exception e) {
            String s = T._("Can not create file ") + newName;
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.