Go to the documentation of this file.
19package org.sleuthkit.autopsy.logicalimager.dsp;
21import java.io.BufferedReader;
22import java.io.IOException;
23import java.io.InputStreamReader;
24import java.util.Arrays;
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 String humanReadableByteCount(long bytes, boolean si)
static boolean isNetworkDrive(String driveLetter)
Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.