@Test public void testStringWithAllBytesNotDisplayable() throws UnsupportedEncodingException { String[] badStrings = new String[4]; badStrings[0] = "44454c4c4d0010518033c6c04f58344a00001b46ce0cffff202100ff0018000fffff000000000019000002a201007673706865726530352e74636c73672e6c6f63616cc1"; badStrings[1] = "44454c4c340010538046b5c04f54344a00001db612e7ffff202100ff0018000fffff000000000019000002a201007673706865726530312e74636c73672e6c6f63616cc1"; badStrings[2] = "44454c4c360010518033b2c04f58344a00001e912535ffff202100ff0018000fffff000000000019000002a201007372762d666230312e74636c73672e6c6f63616c00c1"; badStrings[3] = "42656e61636872696368746967756e67209620546573746d656c64756e6720"; for (String string : badStrings) { assertFalse(new String(hexStringToBytes(string), "Windows-1252"), AbstractSnmpValue.allBytesDisplayable(hexStringToBytes(string))); } }
public static boolean allBytesDisplayable(final byte[] bytes) { if (allBytesUTF_8(bytes)) { return true; } else if (allBytesISO_8859_1(bytes)) { return true; } else { return false; } }
AbstractSnmpValue implements SnmpValue { public static boolean allBytesDisplayable(final byte[] bytes) { if (allBytesUTF_8(bytes)) { return true; } else if (allBytesISO_8859_1(bytes)) { return true; } else { return false; } } }
AbstractSnmpValue implements SnmpValue { public static boolean allBytesDisplayable(final byte[] bytes) { if (allBytesUTF_8(bytes)) { return true; } else if (allBytesISO_8859_1(bytes)) { return true; } else { return false; } }  }
AbstractSnmpValue implements SnmpValue { public static boolean allBytesDisplayable(final byte[] bytes) { if (allBytesUTF_8(bytes)) { return true; } else if (allBytesISO_8859_1(bytes)) { return true; } else { return false; } }  static boolean allBytesDisplayable(final byte[] bytes); static boolean allBytesUTF_8(final byte[] bytes); static boolean allBytesISO_8859_1(byte[] bytes); }
AbstractSnmpValue implements SnmpValue { public static boolean allBytesDisplayable(final byte[] bytes) { if (allBytesUTF_8(bytes)) { return true; } else if (allBytesISO_8859_1(bytes)) { return true; } else { return false; } }  static boolean allBytesDisplayable(final byte[] bytes); static boolean allBytesUTF_8(final byte[] bytes); static boolean allBytesISO_8859_1(byte[] bytes);  }