@@ -421,7 +421,7 @@ public static String formatBytes(long bytes) {
421421 }
422422 }
423423
424- public static long parseBytes (String string ) throws NumberFormatException {
424+ public static long parseBytes (String string , long relativeMultiple ) throws NumberFormatException {
425425 int i = 0 ;
426426 while (i < string .length ()) {
427427 if (!Character .isDigit (string .charAt (i ))) {
@@ -431,6 +431,7 @@ public static long parseBytes(String string) throws NumberFormatException {
431431 }
432432 long size = Long .parseLong (string .substring (0 , i ));
433433 switch (string .substring (i ).trim ().toLowerCase ()) {
434+ case "%" : size = size * relativeMultiple / 100 ; break ;
434435 case "t" : case "tb" : size *= 1024L ; /* no break */
435436 case "g" : case "gb" : size *= 1024L ; /* no break */
436437 case "m" : case "mb" : size *= 1024L ; /* no break */
@@ -457,7 +458,7 @@ public static long parseBytes(String string) throws NumberFormatException {
457458 s = System .getProperty ("org.bytedeco.javacpp.maxBytes" , s );
458459 if (s != null && s .length () > 0 ) {
459460 try {
460- m = parseBytes (s );
461+ m = parseBytes (s , m );
461462 } catch (NumberFormatException e ) {
462463 throw new RuntimeException (e );
463464 }
@@ -469,7 +470,7 @@ public static long parseBytes(String string) throws NumberFormatException {
469470 s = System .getProperty ("org.bytedeco.javacpp.maxPhysicalBytes" , s );
470471 if (s != null && s .length () > 0 ) {
471472 try {
472- m = parseBytes (s );
473+ m = parseBytes (s , m );
473474 } catch (NumberFormatException e ) {
474475 throw new RuntimeException (e );
475476 }
0 commit comments