如何检查SD卡的文件系统的类型? [英] How do I check the type of sdcard's filesystem?
本文介绍了如何检查SD卡的文件系统的类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查SD卡的文件系统的类型?
How to check the type of sdcard's filesystem?
例如,在Windows中,我们可以看到NTFS,FAT32,exFAT的,等等。
For example, in Windows we can see NTFS, FAT32, exFAT, etc.
先谢谢了。
推荐答案
解决方案之一是运行的安装的命令,然后做的结果一些字符串处理:
One solution is to run the mount command then do some string processing on the result:
try{
Process mount = Runtime.getRuntime().exec("mount");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(mount.getInputStream()));
mount.waitFor();
String extPath = Environment.getExternalStorageDirectory().getAbsolutePath();
String line;
while ((line = bufferedReader.readLine()) != null)
{
String[] split = line.split("\\s+");
for(int i = 0; i < split.length - 1; i++)
{
if(split[i].contentEquals(extPath) ||
split[i].contains("sdcard") ||
split[i].contains("_sd") ||
split[i].contains("extSd") ||
split[i].contains("_SD")) // Add wildcards to match against here
{
String strMount = split[i];
String strFileSystem = split[i+1];
// Add to a list/array of mount points and file systems here...
Log.i("SDCard", "mount point: "+ strMount + " file system: " + strFileSystem);
}
}
}
}catch(IOException e){
e.printStackTrace();
}catch(InterruptedException e){
e.printStackTrace();
}
运行这个对我摹临给我的结果如下:
Running this on my G Pro gave me the following results:
mount point: /mnt/media_rw/external_SD file system: vfat
mount point: /storage/external_SD file system: fuse
一些常见的Android的文件系统类型:
Some common Android file system types:
- YAFFS / YAFFS2 - 然而,另一个Flash文件系统
- EXT4 - 扩展文件系统版本4
- 保险丝 - 在用户空间文件系统
- 的tmpfs - 临时文件系统
- VFAT - FAT文件系统扩展
- yaffs/yaffs2 - Yet Another Flash File System
- ext4 - Extended File System version 4
- fuse - File System in User Space
- tmpfs - Temporary File System
- vfat - FAT file system extension
这篇关于如何检查SD卡的文件系统的类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文