如何在android中使用java.nio.file包? [英] How to use java.nio.file package in android?

查看:304
本文介绍了如何在android中使用java.nio.file包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用java.nio.file API为Android创建一个文件管理器应用程序,它是JDK7的一部分。我认为这个(java.noi.file)API包含设计文件管理器应用程序的简单解决方案,其中JDK6(IO)和apache commons IO API没有相同的功能。

I want to create a file manager application for Android using java.nio.file API which is the part of JDK7. I think this (java.noi.file)API contains easy solutions to design file manager application where JDK6(IO) and apache commons IO API does not have the same facility.

请给出一些解决方案,我如何在Android应用程序中使用JDK7(IO)。

Please give some solution, how I use the JDK7 (IO) in android application.

谢谢!

推荐答案

简单的答案是你不能这样做。 Android是基于Java 6的,而(AFAIK)没有Java 7的 java.nio.file 类的后端到Android。

The simple answer is that you can't do it. Android is Java 6 based, and (AFAIK) there is no backport of Java 7's java.nio.file classes to Android.

(这并不奇怪。移植 java.nio.file 将需要对Davlik VM的本机代码库进行重大更改。)

(That's not surprising. Porting java.nio.file would entail significant changes to the Davlik VM's native code libraries.)


您能告诉我应该使用哪种API来满足我的要求。 (我的要求是文件操作,如:剪切|复制|删除文件和目录);

Can you tell me that what API should I use for my requirements. ( My requirement is File operation like : Cut|copy|delete on files and directories);

我建议您只使用 java.io.File 类比如创建目录,重命名文件等,然后使用 File.list()和<$ c实现更高级别操作,例如复制文件和目录树$ c> FileInpuStream 或 FileOutputStream 。您可以使用诸如Apache commons DirectoryWalker FileUtils 或Guava 文件等类来简化某些操作

I suggest you just use the java.io.File class for things like making directories, renaming files, and so on, and then implement the "higher level" operations such as copying files and directory trees using File.list() and FileInpuStream or FileOutputStream. You could possibly simplify some operations using classes such as the Apache commons DirectoryWalker FileUtils or Guava Files.

但是,我不确定你想要在这里实现什么。已经存在适用于Android的文件管理器应用程序。

However, I'm not sure what you are trying to achieve here. There are already existing "file manager" apps for Android.

这篇关于如何在android中使用java.nio.file包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆