当前位置: 首页>>代码示例>>Java>>正文


Java FileSystemRegistry类代码示例

本文整理汇总了Java中javax.microedition.io.file.FileSystemRegistry的典型用法代码示例。如果您正苦于以下问题:Java FileSystemRegistry类的具体用法?Java FileSystemRegistry怎么用?Java FileSystemRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileSystemRegistry类属于javax.microedition.io.file包,在下文中一共展示了FileSystemRegistry类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listFilesystemRoots

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public String[] listFilesystemRoots() {
    String[] res = enumToStringArr(FileSystemRegistry.listRoots());
    for(int iter = 0 ; iter < res.length ; iter++) {
        res[iter] = "file:///" + res[iter];
    }
    return res;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:11,代码来源:GameCanvasImplementation.java

示例2: listFilesystemRoots

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public String[] listFilesystemRoots() {
    String[] res = enumToStringArr(FileSystemRegistry.listRoots());
    for (int iter = 0; iter < res.length; iter++) {
        res[iter] = "file:///" + res[iter];
    }
    return res;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:11,代码来源:BlackBerryImplementation.java

示例3: FileSelector

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
FileSelector(HeartDiagAppMidlet heartDiagApp) {
    super("File Browser", List.IMPLICIT);
    this.heartDiagApp = heartDiagApp;
    deleteAll();
    addCommand(selectCommand);
    addCommand(backCommand);
    setSelectCommand(selectCommand);
    setCommandListener(this);
    FileSystemRegistry.addFileSystemListener(FileSelector.this);
    execute();
}
 
开发者ID:kamcpp,项目名称:heart-diag-app,代码行数:12,代码来源:FileSelector.java

示例4: loadRoots

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
private void loadRoots() {
    if (!rootsList.isEmpty()) {
        rootsList.removeAllElements();
    }
    try {
        Enumeration roots = FileSystemRegistry.listRoots();
        while (roots.hasMoreElements()) {
            String r = (String) roots.nextElement();
            rootsList.addElement(FILE_SEPARATOR + r);
        }
    } catch (Throwable e) {
    }
}
 
开发者ID:kamcpp,项目名称:heart-diag-app,代码行数:14,代码来源:FileSelector.java

示例5: FileSelector

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
FileSelector(HeartDiagAppMidlet heartDiagApp) {
    super("File Browser", List.IMPLICIT);
    this.heartDiagApp = heartDiagApp;
    deleteAll();
    addCommand(selectCommand);        
    addCommand(backCommand);
    setSelectCommand(selectCommand);
    setCommandListener(this);
    FileSystemRegistry.addFileSystemListener(FileSelector.this);
    execute();
}
 
开发者ID:kamcpp,项目名称:heart-diag-app,代码行数:12,代码来源:FileSelector.java

示例6: roots

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
private Vector<String> roots() {
    if(fileroots == null) {
        fileroots = new Vector<String>();
        try {
            for(Enumeration en = FileSystemRegistry.listRoots(); en.hasMoreElements() ; ) {
                String root = (String)en.nextElement();
                if(root.endsWith("/")) {
                    //cut off any trailing /'s
                    root = root.substring(0, root.length() -1);
                    fileroots.addElement(root);
                }
            }
        } catch(SecurityException e) {
            this.securityException(e);
            if(fileroots.size() > 0 ) {
                //got something....
                return fileroots;
            } else {
                //something happened, probably the user denying access to list the roots.
                //return an empty vector, but set fileroots to null so that it'll try again later
                fileroots = null;
                return new Vector<String>();
            }
        } catch(NullPointerException npe) {
            //This exists simply to catch an error in some (MicroEmu's) implementations of listroots
            return new Vector<String>();
        }
    }
    return fileroots;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:31,代码来源:J2meFileSystemProperties.java

示例7: useSDCard

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
public static boolean useSDCard() {
    String root = null;
    Enumeration e = FileSystemRegistry.listRoots();
    while (e.hasMoreElements()) {
        root = (String) e.nextElement();
        if (root.equalsIgnoreCase("sdcard/")) {
            return true;
        }
    }

    return false;
}
 
开发者ID:yanex,项目名称:vika,代码行数:13,代码来源:DeviceMemory.java

示例8: listRoots

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
public String[] listRoots() {
	Enumeration e = FileSystemRegistry.listRoots();
	ArrayList rootv = new ArrayList();
	while (e.hasMoreElements()) rootv.add(e.nextElement());
	String[] roots = new String[rootv.size()];
	for (int i=0; i<rootv.size(); i++) {
		String str = String.valueOf(rootv.get(i));
		if (!str.endsWith("/")) roots[i] = str+'/';
		else roots[i] = str;
	}
	return roots;
}
 
开发者ID:SBasalaev,项目名称:alchemy-os,代码行数:13,代码来源:Helper.java

示例9: getDirModel

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
private ListModel getDirModel() throws IOException {
    Vector dirList = new Vector();

    Enumeration dirContent = null;
    if (currentDir == null) {
        dirContent = FileSystemRegistry.listRoots();
    } else {
        FileConnection conn = (FileConnection) Connector.open(currentDir, Connector.READ);
        if(conn.exists()) dirContent = conn.list();
        else {
            currentDir = null;
            dirContent = FileSystemRegistry.listRoots();
        }
    }

    if (dirContent != null) {
        if (currentDir != null) dirList.addElement(new UpDirectory());
        while (dirContent.hasMoreElements()) {
            String filename = (String) dirContent.nextElement();

            if (isDirectory(filename)) {
                dirList.addElement(new Directory(filename));
            } else {
                if(!directoriesOnly && (fileEndingFilter == null || "".equals(fileEndingFilter) || filename.toLowerCase().endsWith(fileEndingFilter))) {
                    dirList.addElement(new File(filename));
                }
            }
        }
    }
    
    // sorts the list alphabetically: first up, second dirs, third files
    QuickSorter.sort(dirList);
    
    return new DefaultListModel(dirList);
}
 
开发者ID:csperle,项目名称:KeePassMobile,代码行数:36,代码来源:FileChooserForm.java

示例10: getRootNames

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
/**
 * Get a list of root directories on the device
 * @return
 */
public String[] getRootNames() throws FileException
{
    return enumtoStringArr( FileSystemRegistry.listRoots() );
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:9,代码来源:J2MEFileService.java

示例11: test0001

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
public void test0001() {
	Enumeration e = FileSystemRegistry.listRoots();
	if (e==null) {
		addOperationDesc("Enumeration was null");
		assertTrueWithLog("Tests listRoots()", false);
		return;
	} else {
		addOperationDesc("listRoots() returned:");
		int i= 0;
		while(e.hasMoreElements()) {
			i++;
			String root = (String)e.nextElement();
			addOperationDesc(i + ". " + root);
			if (root==null) {
				addOperationDesc("Root was null");
				assertTrueWithLog("Tests listRoots()", false);
				return;
			}
			if (!root.endsWith("/")) {
				addOperationDesc("Root does not end with slash: " + root);
				assertTrueWithLog("Tests listRoots()", false);
				return;
			}
		}
	}
	
	addOperationDesc("");
	
	boolean passed = false;
	if (!e.hasMoreElements()) {
		try {
			e.nextElement();
			addOperationDesc("NoSuchElementException expected");
			passed = false;
		} catch (NoSuchElementException ex) {
			addOperationDesc("NoSuchElementException thrown as expected");
			passed = true;
		}
	}
	
	assertTrueWithLog("Tests listRoots()", passed);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:43,代码来源:ListRoots.java

示例12: openRoot

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
private void openRoot() {
    currentElements = FileSystemHelper.getElementsList(FileSystemRegistry.listRoots());
}
 
开发者ID:queader,项目名称:Comcraft,代码行数:4,代码来源:FileBrowser.java

示例13: setDir

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
public void setDir(String location) {
	FileConnection dir = null;
	Enumeration fsEnum;
	try {
		if (location == null) {
			fsEnum = FileSystemRegistry.listRoots();
			this.setTitle("FS Roots");
		} else {
			System.out.println("cd " + location);
			String sep = "";
			if (location.charAt(0) != DIR_SEP) {
				sep = String.valueOf(DIR_SEP);
			}
			dir = (FileConnection) Connector.open("file://localhost" + sep + location);
			if (!dir.isDirectory()) {
				FCViewMIDlet.setCurrentDisplayable(new FileEditor(dir, this));
				return;
			}
			this.setTitle(dir.getPath() + dir.getName());
			fsEnum = dir.list();
			System.out.println("new location " + dir.getURL());
		}

		this.deleteAll();
		if (location != null) {
			this.append("..", dirIcon);
		}
		while (fsEnum.hasMoreElements()) {
			String fileName = (String) fsEnum.nextElement();
			if (fileName.charAt(fileName.length() - 1) == DIR_SEP) {
				this.append(fileName, dirIcon);
			} else {
				this.append(fileName, fileIcon);
			}
		}
		if (currentDir != null) {
			currentDir.close();
		}
		currentDir = dir;
	} catch (IOException e) {
		showError(e.getMessage());
	}
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:44,代码来源:FilesList.java

示例14: getRootNames

import javax.microedition.io.file.FileSystemRegistry; //导入依赖的package包/类
/**
 * Get a list of root directories on the device
 * @return
 */
public static Enumeration getRootNames() {
    return FileSystemRegistry.listRoots();
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:8,代码来源:FileUtility.java


注:本文中的javax.microedition.io.file.FileSystemRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。