19 package org.sleuthkit.autopsy.logicalimager.dsp;
21 import java.io.BufferedReader;
22 import java.io.IOException;
23 import java.io.InputStreamReader;
24 import java.util.Arrays;
25 import java.util.List;
42 int unit = si ? 1000 : 1024;
46 int exp = (int) (Math.log(bytes) / Math.log(unit));
47 String pre = (si ?
"kMGTPE" :
"KMGTPE").charAt(exp - 1) + (si ?
"" :
"i");
48 return String.format(
"%.1f %sB", bytes / Math.pow(unit, exp), pre);
62 List<String> cmd = Arrays.asList(
"cmd",
"/c",
"net",
"use", driveLetter +
":");
65 Process p =
new ProcessBuilder(cmd)
66 .redirectErrorStream(
true)
69 p.getOutputStream().close();
71 StringBuilder consoleOutput =
new StringBuilder();
74 try (BufferedReader in =
new BufferedReader(
new InputStreamReader(p.getInputStream()))) {
75 while ((line = in.readLine()) != null) {
76 consoleOutput.append(line).append(
"\r\n");
82 }
catch(IOException | InterruptedException e) {
static boolean isNetworkDrive(String driveLetter)
static String humanReadableByteCount(long bytes, boolean si)