-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为什么读取NTFS、exFAT文件系统的SD卡数据很慢?读取FAT32就很快? #418
Comments
我发现实际上是usbFile.listFiles() 这个方法很慢,不清楚为什么? |
` @throws(IOException::class)
15:56:05.770 25808-27815 USB_lib com...usbfileman D 开是检索文件 |
39秒才执行完 currentDir.listFiles() 是不是太慢了? |
请问下你是怎么读取ntfs文件系统的,我可以读取fat32的u盘。但是当我读取ntfs的移动硬盘时,在执行到init()初始化设备方法时就抛出了不支持的文件系统异常 |
我用了不同文件系统的SD卡测试读取SD卡上的照片,发现NTFS、exFAT文件系统的SD卡数据很慢,读取FAT32就很快,
代码如下:
`
private fun setupDevice() {
try {
massStorageDevices[currentDevice].init()
@throws(IOException::class)
fun searchImages(usbFiles: Array): ArrayList? {
val files = ArrayList()
for (usbFile in usbFiles) {
if (usbFile.isDirectory && usbFile.name == "DCIM") { //找到相册
val photosFolder = usbFile.listFiles()
Log.d(TAG, photosFolder.contentToString())
if (photosFolder.isNotEmpty()) { //相册下的文件夹大于0
for (file in photosFolder) {
if (file.isDirectory) {
val images = file.listFiles()
Log.d(TAG, images.contentToString())
for (image in images) {
if (image.name.endsWith("JPEG") || image.name.endsWith("JPG")) {
files.add(image)
}
}
}
}
}
}
}
return files
}`
同样1500张图片,NTFS、exFAT文件系统的SD卡需要1分多钟才能读完,FAT32文件系统的SD卡只需要几秒钟,这时为什么?
The text was updated successfully, but these errors were encountered: