Here you can find the source of getFileSize(File file)
Parameter | Description |
---|---|
file | a parameter |
public static long getFileSize(File file)
import java.io.File; import java.io.IOException; import org.apache.log4j.Logger; public class Main{ /**/*from w w w. j a v a2s .c o m*/ * Returns file size. * * @param file * @return file size in bytes * @see http://stackoverflow.com/questions/116574/java-get-file-size-efficiently */ public static long getFileSize(File file) { if (file.exists()) { return file.length(); } else { return 0; } } }