Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2008

Tip: Looking for answers? Try searching our database.

A Nonexistant File

Thread view: 
Jason Cavett - 04 Jan 2008 17:44 GMT
Is there a specific String I can use to create a file such that
file.exists() will always return false?

Basically, I'm trying to avoid having to check for null all the time.
So, when I create a new project, I want to set it's starting save path
(AKA it hasn't been saved yet) to something where file.exists() =
false.  String path = new String("") *seems* to work, but I wanted to
make sure.

Thanks
External Concepts Guild - 05 Jan 2008 14:37 GMT
> Is there a specific String I can use to create a file such that
> file.exists() will always return false?
[quoted text clipped - 6 lines]
>
> Thanks

Probably not.  If there were, it would be OS specific.

Maybe you could use
File.createTempFile(String prefix,String suffix).

Emory Merryman
External Concepts Guild
Mike Schilling - 05 Jan 2008 20:25 GMT
> Is there a specific String I can use to create a file such that
> file.exists() will always return false?
[quoted text clipped - 7 lines]
> to
> make sure.

File isn't a final class.  Create a subclass in which File.exists()
returns false.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.