Android SDCard Size Get getMounts(CharSequence path)

Here you can find the source of getMounts(CharSequence path)

Description

get Mounts

Declaration

public static String[] getMounts(CharSequence path) 

Method Source Code

//package com.java2s;
import java.io.BufferedReader;

import java.io.FileNotFoundException;

import java.io.FileReader;

import java.io.IOException;

import android.util.Log;

public class Main {
    public static String[] getMounts(CharSequence path) {
        BufferedReader bufferedReader = null;
        try {/*from ww w  . j a  v  a2s  .  c  om*/
            bufferedReader = new BufferedReader(new FileReader(
                    "/proc/mounts"), 256);
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                if (line.contains(path)) {
                    return line.split(" ");
                }
            }
        } catch (FileNotFoundException ignored) {
            Log.d("TAG", "/proc/mounts does not exist");
        } catch (IOException ignored) {
            Log.d("TAG", "Error reading /proc/mounts");
        } finally {
            if (bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (IOException ignored) {
                    // ignored
                }
            }
        }
        return null;
    }
}

Related

  1. getSDPath()
  2. getMounts(CharSequence path)
  3. getAvailableMb(String path)
  4. getUsableSpace(File path)
  5. getUsableSpace(File path)