开发者

How to move a file using Java [closed]

It's difficult to tell what is 开发者_如何学Cbeing asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

How to move one file (eg. .txt or .jpg) to one particular folder in Java? I want line by line explanation. I know InputStream and OutputStream read from InputStream and write to OutputStream. But how do they take bytes etc.? Any ideas?


You wouldn't do it by reading/writing the contents of the file. Look at the File Javadoc. You can use the File class to rename and move individual files at a file level -- without having to access the contents of the files. In particular, see the renameTo and mkdirs methods of File.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜