@Test public void byteArrayToOctalString() throws Exception { String orig = "Have Narisha"; String octal = "Rash Rash Rash!"; String expected = orig + "\\\\122\\\\141\\\\163\\\\150\\\\040" + "\\\\122\\\\141\\\\163\\\\150\\\\040" + "\\\\122\\\\141\\\\163\\\\150\\\\041"; StringBuilder sb = new StringBuilder(); sb.append(orig); Utilities.byteArrayToOctalString(octal.getBytes(), sb); assertEquals(orig.length() + (octal.length() * 5), sb.length()); assertEquals(expected, sb.toString()); }
public static void byteArrayToOctalString(byte[] bytes, StringBuilder sb) { if ((bytes == null) || (sb == null)) { return; } sb.ensureCapacity(sb.length() + (bytes.length * 5 )); for (int b : bytes) { sb.append(String.format("\\\\%03o", b & 0xff)); } }
Utilities { public static void byteArrayToOctalString(byte[] bytes, StringBuilder sb) { if ((bytes == null) || (sb == null)) { return; } sb.ensureCapacity(sb.length() + (bytes.length * 5 )); for (int b : bytes) { sb.append(String.format("\\\\%03o", b & 0xff)); } } }
Utilities { public static void byteArrayToOctalString(byte[] bytes, StringBuilder sb) { if ((bytes == null) || (sb == null)) { return; } sb.ensureCapacity(sb.length() + (bytes.length * 5 )); for (int b : bytes) { sb.append(String.format("\\\\%03o", b & 0xff)); } }  }
Utilities { public static void byteArrayToOctalString(byte[] bytes, StringBuilder sb) { if ((bytes == null) || (sb == null)) { return; } sb.ensureCapacity(sb.length() + (bytes.length * 5 )); for (int b : bytes) { sb.append(String.format("\\\\%03o", b & 0xff)); } }  static byte[] parseBase64(String encoded, String paramName); static boolean isValidDirectoryName(String name); static boolean isValidRestrictedDirectoryName(String name); static Object createAnyInstance(Class<?> confClass,
                                           String className, RequestContext metaData); static Object createAnyInstance(String className); static void byteArrayToOctalString(byte[] bytes, StringBuilder sb); static String maskNonPrintables(String input); static FragmentMetadata parseFragmentMetadata(RequestContext context); static boolean aggregateOptimizationsSupported(RequestContext requestContext); static boolean implementsInterface(String className, Class<?> iface); static boolean isFragmenterCacheEnabled(); static String absoluteDataPath(String dataSource); static boolean isSecurityEnabled(Configuration configuration); static String rightTrimWhiteSpace(String s); static String getHost(String uri); }
Utilities { public static void byteArrayToOctalString(byte[] bytes, StringBuilder sb) { if ((bytes == null) || (sb == null)) { return; } sb.ensureCapacity(sb.length() + (bytes.length * 5 )); for (int b : bytes) { sb.append(String.format("\\\\%03o", b & 0xff)); } }  static byte[] parseBase64(String encoded, String paramName); static boolean isValidDirectoryName(String name); static boolean isValidRestrictedDirectoryName(String name); static Object createAnyInstance(Class<?> confClass,
                                           String className, RequestContext metaData); static Object createAnyInstance(String className); static void byteArrayToOctalString(byte[] bytes, StringBuilder sb); static String maskNonPrintables(String input); static FragmentMetadata parseFragmentMetadata(RequestContext context); static boolean aggregateOptimizationsSupported(RequestContext requestContext); static boolean implementsInterface(String className, Class<?> iface); static boolean isFragmenterCacheEnabled(); static String absoluteDataPath(String dataSource); static boolean isSecurityEnabled(Configuration configuration); static String rightTrimWhiteSpace(String s); static String getHost(String uri); static final Pattern SCHEME_PATTERN; static final Pattern NON_HOSTNAME_CHARACTERS; }