Android File Size get getFileLength(String path)

Here you can find the source of getFileLength(String path)

Description

get File Length

Declaration

public static Long getFileLength(String path) 

Method Source Code

//package com.java2s;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class Main {
    public static Long getFileLength(String path) {
        Long fileLength = null;//from   w ww .jav  a 2  s. c  om
        try {
            FileInputStream in = new FileInputStream(path);
            File file = new File(path);
            fileLength = file.length();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return fileLength;
    }
}

Related

  1. getFileSize(File file)
  2. getFileSize(File f)
  3. getFileSizes(File f)
  4. fileLength(String filePath)
  5. fileLength(long length)
  6. getFileSize(long fileSize)