Package javax.microedition.io.file

Examples of javax.microedition.io.file.FileConnection


        display.setCurrent(creator);
    }

    void createFile(String newName, boolean isDirectory) {
        try {
            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;
            if (e.getMessage() != null && e.getMessage().length() > 0) {
                s += "\n" + e;
View Full Code Here


    public int addPath(String path, boolean rescan) throws IOException {
        System.out.println("Adding path to DB " + path);
        int probCnt = problems.size();

        if (path.endsWith(".sgfi")) {
            FileConnection fc = (FileConnection) Connector.open(
                    "file://localhost/" + path);
            readIndex(path, fc.openInputStream(), false);
        } else {
            rescan |= paths.indexOf(path) < 0;
            if (rescan) {
                removePath(path);
                path = addPath(path);
                FileConnection fc = (FileConnection) Connector.open(
                        "file://localhost/" + path);
                if (fc.isDirectory())
                    addDir(path, fc, path);
                else
                    addProblems(path, null, fc.openInputStream(), false);
            }
        }
        return problems.size() - probCnt;
    }
View Full Code Here

            e = dir.list();

        while (e.hasMoreElements()) {
            String p = path + (String) e.nextElement();

            FileConnection fc = (FileConnection) Connector.open(
                    "file://localhost/" + p);
            if (fc.isDirectory())
                addDir(p, fc, topDir);
            else {
                addProblems(p, topDir, fc.openInputStream(), false);
            }
            fc.close();
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public OutputStream openOutputStream() throws IOException
    {
        final FileConnection connection = (FileConnection)Connector.open( PREFIX + path_ );
        if( !connection.exists() )
            connection.create();
        final OutputStream stream = connection.openOutputStream();
        connection.close();
        return stream;
    }
View Full Code Here

     */
    public boolean exists()
    {
        try
        {
            final FileConnection connection = (FileConnection)Connector.open( PREFIX + path_, Connector.READ );
            final boolean exists = connection.exists();
            connection.close();
            return exists;
        }
        catch( IOException e )
        {
            return false;
View Full Code Here

        }
    }

    private Enumeration list() throws IOException
    {
        final FileConnection connection = (FileConnection)Connector.open( PREFIX + path_, Connector.READ );
        final Enumeration enumeration = connection.list();
        connection.close();
        return enumeration;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void create( final String name ) throws IOException
    {
        final FileConnection connection = (FileConnection)Connector.open( PREFIX + path_ + name, Connector.WRITE );
        connection.mkdir();
        connection.close();
    }
View Full Code Here

        if (folder == null) {
            return;
        }

        try {
            FileConnection f =
                    (FileConnection) Connector.open(folder, Connector.READ);

            if (f.exists() && f.isDirectory()) {

                final Enumeration filesList =
                        f.list("*" + Dictionary.FILE_EXTENSION, true);

                while (filesList.hasMoreElements()) {

                    final String s = (String) filesList.nextElement();

View Full Code Here

    public ArchiveEntry getEntry(String name) {
        try {
            //#debug
            AlbiteMIDlet.LOGGER.log("Searching for *" + name + "*");

            FileConnection file = (FileConnection) Connector.open(name);
            if (file.exists() && !file.isDirectory()) {
                return new ArchiveFileEntry(file);
            }
        } catch (IOException e) {
            //#debug
            AlbiteMIDlet.LOGGER.log(e);
View Full Code Here

            throws IOException {

        try {
            //#debug
            AlbiteMIDlet.LOGGER.log("Opening [" + filename + "]...");
            final FileConnection file = (FileConnection) Connector.open(
                    filename, Connector.READ_WRITE);
            //#debug
            AlbiteMIDlet.LOGGER.log(file != null);
            return file;
        } catch (SecurityException e) {
View Full Code Here

TOP

Related Classes of javax.microedition.io.file.FileConnection

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.