Jump to content

Java File.length() vs File.getTotalSpace()


sees_all1

Recommended Posts

Anyone know the difference between the two?

 

Also, if I wanted to make an exact copy of a file, would File.getTotalSpace() necessarily have to be the same between the copies, especially between different operating systems?

99 dungeoneering achieved, thanks to everyone that celebrated with me!

 

♪♪ Don't interrupt me as I struggle to complete this thought
Have some respect for someone more forgetful than yourself ♪♪

♪♪ And I'm not done
And I won't be till my head falls off ♪♪

Link to comment
Share on other sites

[spoiler=length]length

public long length()Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory.

 

Returns:

The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist. Some operating systems may return 0L for pathnames denoting system-dependent entities such as devices or pipes.

 

[spoiler=getTotalSpace]getTotalSpace

public long getTotalSpace()Returns the size of the partition named by this abstract pathname.

 

Returns:

The size, in bytes, of the partition or 0L if this abstract pathname does not name a partition

 

 

You Probably want to use length because from what I can tell getTotalSpace is for checking information on Drives (and possibly folders) Contained disk space.

Luna_pirate_signature.png

Thanks to DrCue at DeviantArt for the signature source

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.