Here you can find the source of getFileSize(String loc)
Parameter | Description |
---|---|
loc | file location |
private static long getFileSize(String loc)
//package com.java2s; //License from project: LGPL import java.io.File; public class Main { /**//from ww w . j av a 2 s.c om * Returns the length of a file in bytes given its location. * * @param loc file location * @return file length */ private static long getFileSize(String loc) { File f = new File(loc); if (!f.exists()) { System.err.println("File " + loc + " does not exist"); System.exit(1); } long leng = f.length(); if (leng == 0) { System.err.println("File " + loc + " has zero length"); System.exit(1); } return leng; } }