@Test public void formatPermission() { assertEquals("-rw-rw-rw-", FormatUtils.formatMode((short) 0666, false, false)); assertEquals("drw-rw-rw-", FormatUtils.formatMode((short) 0666, true, false)); assertEquals("-rwxrwxrwx", FormatUtils.formatMode((short) 0777, false, false)); assertEquals("drwxrwxrwx", FormatUtils.formatMode((short) 0777, true, false)); assertEquals("-r--r--r--", FormatUtils.formatMode((short) 0444, false, false)); assertEquals("dr--r--r--", FormatUtils.formatMode((short) 0444, true, false)); assertEquals("-r-xr-xr-x", FormatUtils.formatMode((short) 0555, false, false)); assertEquals("dr-xr-xr-x", FormatUtils.formatMode((short) 0555, true, false)); assertEquals("-rwxr-xr--", FormatUtils.formatMode((short) 0754, false, false)); assertEquals("drwxr-xr--", FormatUtils.formatMode((short) 0754, true, false)); }
public static String formatMode(short mode, boolean directory, boolean hasExtended) { StringBuilder str = new StringBuilder(); if (directory) { str.append("d"); } else { str.append("-"); } str.append(new Mode(mode).toString()); if (hasExtended) { str.append("+"); } return str.toString(); }
FormatUtils { public static String formatMode(short mode, boolean directory, boolean hasExtended) { StringBuilder str = new StringBuilder(); if (directory) { str.append("d"); } else { str.append("-"); } str.append(new Mode(mode).toString()); if (hasExtended) { str.append("+"); } return str.toString(); } }
FormatUtils { public static String formatMode(short mode, boolean directory, boolean hasExtended) { StringBuilder str = new StringBuilder(); if (directory) { str.append("d"); } else { str.append("-"); } str.append(new Mode(mode).toString()); if (hasExtended) { str.append("+"); } return str.toString(); } private  FormatUtils(); }
FormatUtils { public static String formatMode(short mode, boolean directory, boolean hasExtended) { StringBuilder str = new StringBuilder(); if (directory) { str.append("d"); } else { str.append("-"); } str.append(new Mode(mode).toString()); if (hasExtended) { str.append("+"); } return str.toString(); } private  FormatUtils(); static String parametersToString(Object... objs); static String byteBufferToString(ByteBuffer buf); static String byteArrayToHexString(byte[] bytes); static String byteArrayToHexString(byte[] bytes, String prefix, String separator); static String formatTimeTakenMs(long startTimeMs, String message); static String formatTimeTakenNs(long startTimeNs, String message); static String getSizeFromBytes(long bytes); static long parseSpaceSize(String spaceSize); static long parseTimeSize(String timeSize); static String formatMode(short mode, boolean directory, boolean hasExtended); }
FormatUtils { public static String formatMode(short mode, boolean directory, boolean hasExtended) { StringBuilder str = new StringBuilder(); if (directory) { str.append("d"); } else { str.append("-"); } str.append(new Mode(mode).toString()); if (hasExtended) { str.append("+"); } return str.toString(); } private  FormatUtils(); static String parametersToString(Object... objs); static String byteBufferToString(ByteBuffer buf); static String byteArrayToHexString(byte[] bytes); static String byteArrayToHexString(byte[] bytes, String prefix, String separator); static String formatTimeTakenMs(long startTimeMs, String message); static String formatTimeTakenNs(long startTimeNs, String message); static String getSizeFromBytes(long bytes); static long parseSpaceSize(String spaceSize); static long parseTimeSize(String timeSize); static String formatMode(short mode, boolean directory, boolean hasExtended);  }