Lines Matching refs:path

127      * @param path  the path to get free space for, not null, not empty on Unix

129 * @throws IllegalArgumentException if the path is invalid
136 public static long freeSpace(String path) throws IOException {
137 return INSTANCE.freeSpaceOS(path, OS, false);
158 * @param path the path to get free space for, not null, not empty on Unix
160 * @throws IllegalArgumentException if the path is invalid
165 public static long freeSpaceKb(String path) throws IOException {
166 return INSTANCE.freeSpaceOS(path, OS, true);
180 * @param path the path to get free space for, not null, not empty on Unix
184 * @throws IllegalArgumentException if the path is invalid
188 long freeSpaceOS(String path, int os, boolean kb) throws IOException {
189 if (path == null) {
194 return (kb ? freeSpaceWindows(path) / 1024 : freeSpaceWindows(path));
196 return freeSpaceUnix(path, kb, false);
198 return freeSpaceUnix(path, kb, true);
211 * @param path the path to get free space for, including the colon
215 long freeSpaceWindows(String path) throws IOException {
216 path = FilenameUtils.normalize(path);
217 if (path.length() > 2 && path.charAt(1) == ':') {
218 path = path.substring(0, 2); // seems to make it work
222 String[] cmdAttribs = new String[] {"cmd.exe", "/C", "dir /-c " + path};
234 return parseDir(line, path);
240 "for path '" + path + "'");
247 * @param path the path that was sent
251 long parseDir(String line, String path) throws IOException {
282 "for path '" + path + "'");
292 return parseBytes(buf.toString(), path);
299 * @param path the path to get free space for
305 long freeSpaceUnix(String path, boolean kb, boolean posix) throws IOException {
306 if (path.length() == 0) {
309 path = FilenameUtils.normalize(path);
320 (flags.length() > 1 ? new String[] {"df", flags, path} : new String[] {"df", path});
328 "for path '" + path + "'- response was " + lines);
342 "for path '" + path + "'- check path is valid");
350 return parseBytes(freeSpace, path);
358 * @param path the path
362 long parseBytes(String freeSpace, String path) throws IOException {
368 "for path '" + path + "'- check path is valid");
375 "for path '" + path + "'- check path is valid");