纠正一个错了很久的事情
最近比较闲,到处翻文档看着玩。
突然发现我错了很久的一个事情,还一度埋怨SUN做的什么破玩意。
原来,还是最终还是我错了。错在浮躁跟粗心。
事情是这样的
File下边的deleteOnExit()这个方法。我一直以为是deleteOnExist()了,javadoc也没看过,因为觉得方法名已经表述的很清楚了,奶奶的,错了我好几年。
Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates. Deletion will be attempted only for normal termination of the virtual machine, as defined by the Java Language Specification.
Once deletion has been requested, it is not possible to cancel the request. This method should therefore be used with care.
Note: this method should not be used for file-locking, as the resulting protocol cannot be made to work reliably. The FileLock facility should be used instead
检讨检讨中…………
做学问要踏实,做民工也要踏实。
最近评论