Languages
[Edit]
EN

Java - get file information

0 points
Created by:
Alicia-Lambert
580

In this article, we would like to show you how to get file information in Java.

There are several methods to get file information in Java.io.File package:

  • getName() - returns the name of the given file object,
  • getAbsolutePath() - returns the absolute pathname of the given file object,
  • canWrite() - returns a boolean value representing whether the application is allowed to write the file or not,
  • canRead() - returns a boolean value representing whether the application is allowed to read the file or not,
  • getParent() - returns a String value which is the path of the Parent of the given file object,
  • length() - returns the length of the file in bits.

Practical example

Edit

Related posts

Edit

Alternative titles

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Java - file operations

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join