关于File.getPath,File.getAbsolutePath,File.getCanonicalPath的区别
这个问题, 不了解一下还是挺恍惚它们之间的区别的.
其实也挺简单的.
getPath()-->>new File()时的路径 getAbsolutePath()-->>当前路径+new File()时的路径 getCanonicalPath()-->>规范路径真正意义的绝对路径
这里面的文章主要还是只new File()的时候加入了"."和".."如何用了这2个. getAbsolutePath()就是如上面解释的一样.而getCanonicalPath()会把"."和".."翻译过来.
就是这么简单.
关于File.getPath,File.getAbsolutePath,File.getCanonicalPath的区别的更多相关文章
- File 类的 getPath()、getAbsolutePath()、getCanonicalPath() 的区别【转】
File 类的 getPath().getAbsolutePath().getCanonicalPath() 的区别 感谢大佬:https://blog.csdn.net/zsensei/articl ...
- java里getPath、 getAbsolutePath、getCanonicalPath的区别
本文链接:https://blog.csdn.net/wh_19910525/article/details/9314675 File的这三个方法在api中都有说明,仅以程序为例说明. package ...
- file的getPath getAbsolutePath和getCanonicalPath的区别
转自:http://www.blogjava.net/dreamstone/archive/2007/08/08/134968.html file的这几个取得path的方法各有不同,下边说说详细的区别 ...
- File的getPath()和getAbsolutePath()和getCanonicalPath()的差别
这几个方法是有一次无意的发现,我当时也不知道什么意思,就百度了,查到了一些列子: 原文地址http://www.blogjava.net/dreamstone/archive/2007/08/08/1 ...
- file的getPath getAbsolutePath和getCanonicalPath的不同
file的这几个取得path的方法各有不同,下边说说详细的区别 概念上的区别:(内容来自jdk,个人感觉这个描述信息,只能让明白的人明白,不明白的人看起来还是有点难度(特别试中文版,英文版稍好些)所以 ...
- file.getPath() getAbsolutePath() getCanonicalPath()区别
package file; import java.io.File; import java.io.IOException; public class getFilePath { public sta ...
- Visual Studio发布Web项目报错:Unable to add 'xxx' to the Web site. Unable to add file 'xxx'. The specified file could not be encrypted.
背景 Visual Studio下的Web项目 现象 发布时遇到Unable to add 'xxx' to the Web site. Unable to add file 'xxx'. The ...
- 配置tomcat连接器后,启动服务报错“No Certificate file specified or invalid file format"异常
1:原来的配置是 <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true&quo ...
- 配置CAS错误No Certificate file specified or invalid file format
配置tomcat证书 keystore文件后启动一直报错:(tomcat版本:apache-tomcat-6.0.43) tomcat配置: <Connector port="8443 ...
- ShopEx访问提示Incompatible file format: The encoded file has format major ID 2, whereas the Loader expects 4
今天测试了下ShopEx程序,但是ShopEx安装时(程序放在public_html目录下的test目录中)遇到了问题,提示错误如下:Fatal error: Incompatible file fo ...
随机推荐
- CCMoveTo 等函数理解
CCMoveTo: 使用CCMoveTo action来让对象从右侧屏幕外移动到屏幕左侧.注意可以通过指定duration参数控制这一过程需要多久,这里我们随机给他2-4秒的时间. CCCallFun ...
- 【剑指offer 面试题21】包含min函数的栈
思路: 通过增加一个辅助栈保存每个状态对应的最小值.栈实现的不完整,应该还包含empty()等常规函数. #include <iostream> #include <stack> ...
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 list_should_have_no_selections(self, locator)
def list_should_have_no_selections(self, locator): """Verifies select list identified ...
- Authentication with SignalR and OAuth Bearer Token
Authentication with SignalR and OAuth Bearer Token Authenticating connections to SignalR is not as e ...
- GRID控件删除之前确认
<asp:TemplateField HeaderText="删除新闻" ShowHeader="False"><ItemTemplate&g ...
- redo文件二
为什么要引入LGWR后台进程和redo log buffer 如果使用前台进程来将redo的信息写入到redo日志文件组中,那么会导致并发的前台进程对redo日志文件组的争用,从而使用后台进程LGWR ...
- 当rsync遇到非默认端口的ssh
在使用rsync使用ssh协议,来同步远程文件的方法,rsync -zvrtopg -e ssh但是如果遇到ssh不是22端口的时候使用rsync -zvrtopg -e ‘ssh -p 端口’特别是 ...
- A题进行时--浙大PAT 1011-1020
#include<stdio.h> #include<string.h> int main(){ ]; ]; ]; ]; ]; int i; float sum; memset ...
- Codevs No.1163 访问艺术馆
2016-05-31 20:48:47 题目链接: 访问艺术馆 (Codevs No.1163) 题目大意: 一个贼要在一个二叉树结构的艺术馆中偷画,画都处于叶子节点处,偷画和经过走廊都需要时间,求在 ...
- 问题-某个程序改了ICO图标后编译后还是显示老图标?
问题现象:某个程序改了ICO图标后编译后还是显示老图标? 问题原原:可能是因为系统的缓存问题. 问题处理:把程序的EXE放在别的路径下打开就可以了. 问题相关人员:QQ253120114(朋友) Q ...