@Override Object decode(Decoder dec, String s) throws Exception { return Hex.toByteArray(s); } }
@Override public Object convert(Type dest, Object o) throws Exception { if (o instanceof String) { String s = (String) o; if (Hex.isHex(s)) return Hex.toByteArray(s); } return null; } });
public final static String toHexString(byte data[]) { StringBuilder sb = new StringBuilder(); try { append(sb, data); } catch (IOException e) { // cannot happen with sb } return sb.toString(); }
@Override public String toString() { try { return "P-" + getResource(); } catch (Exception e) { return "P-" + Hex.toHexString(sha); } }
public static String separated(byte[] bytes, String separator) { String del=""; StringBuilder sb = new StringBuilder(); for ( byte x : bytes) { sb.append(del); sb.append(toHex(x)); del = separator; } return sb.toString(); } }
public final static String toHexString(byte data[]) { StringBuilder sb = new StringBuilder(); try { append(sb,data); } catch (IOException e) { // cannot happen with sb } return sb.toString(); }
@Override public void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception { StringHandler.string(app, Hex.toHexString((byte[]) object)); }
@Override public Object convert(Type dest, Object o) throws Exception { if (o instanceof String) return Hex.toByteArray((String) o); return null; } });
public static String separated(byte[] bytes, String separator) { String del=""; StringBuilder sb = new StringBuilder(); for ( byte x : bytes) { sb.append(del); sb.append(toHex(x)); del = separator; } return sb.toString(); } }
public final static String toHexString(byte data[]) { StringBuilder sb = new StringBuilder(); try { append(sb, data); } catch (IOException e) { // cannot happen with sb } return sb.toString(); }
public String toString() { try { return "P-" + getResource(); } catch (Exception e) { return "P-" + Hex.toHexString(sha); } }
public final static String toHexString(byte data[]) { StringBuilder sb = new StringBuilder(); try { append(sb, data); } catch (IOException e) { // cannot happen with sb } return sb.toString(); }
@Override public String toString() { try { return "P-" + getResource(); } catch (Exception e) { return "P-" + Hex.toHexString(sha); } }
public final static String toHexString(byte data[]) { StringBuilder sb = new StringBuilder(); try { append(sb, data); } catch (IOException e) { // cannot happen with sb } return sb.toString(); }
/** * Set the private key in the settings for this machine * * @param hex * @param data * @return * @throws Exception */ private String tos(boolean hex, byte[] data) { return data.length + " : " + (hex ? Hex.toHexString(data) : Base64.encodeBase64(data)); }
public final static String toHexString(byte data[]) { StringBuilder sb = new StringBuilder(); try { append(sb, data); } catch (IOException e) { // cannot happen with sb } return sb.toString(); }