List of utility methods to do XML Data Type Converter
void | addBasicAuthorization(String username, String password, HttpURLConnection connection) add Basic Authorization String credentials = toBase64Encoded( new StringBuilder().append(username).append(':').append(password).toString()); connection.setRequestProperty(PROPERTY_AUTHORIZATION, new StringBuilder().append(PROPERTY_BASIC).append(' ').append(credentials).toString()); |
void | appendByteAsJavaByteInitializer(StringBuilder sb, byte b) append Byte As Java Byte Initializer if (b >= 0 && b < 128) { if (Character.isAlphabetic(b)) { sb.append("'").append((char) b).append("'"); } else { sb.append("0x").append(javax.xml.bind.DatatypeConverter.printHexBinary(new byte[] { b })); } else { sb.append("(byte)0x").append(javax.xml.bind.DatatypeConverter.printHexBinary(new byte[] { b })); ... |
String | byteArrayAsUrlString(byte[] bytes) byte Array As Url String return DatatypeConverter.printBase64Binary(bytes).replace('/', '_').replace('+', '-').replace('=', '.'); |
int | calculateCR16(String value) calculate CR final byte[] bytes = toByteArray(value); int crc_accum = 0; int i; for (byte aByte : bytes) { i = ((crc_accum >> 8) ^ (aByte)) & 0xFF; crc_accum = (crc_accum << 8) ^ table[i]; return crc_accum; ... |
String | calculateHMAC(final String secretKey, final String feedId) Calculate HMAC. SecretKeySpec signingKey = new SecretKeySpec(toSHA1(secretKey), HMAC_SHA1); Mac mac = Mac.getInstance(HMAC_SHA1); mac.init(signingKey); return escapeDigest(DatatypeConverter.printBase64Binary(mac.doFinal(feedId.getBytes(UTF_8)))); |
byte[] | compress(String string) compress byte[] compressed = null; try { ByteArrayOutputStream os = new ByteArrayOutputStream(string.length()); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(string.getBytes()); gos.close(); compressed = os.toByteArray(); os.close(); ... |
byte[] | compress(String string) compress byte[] compressed = null; try { ByteArrayOutputStream os = new ByteArrayOutputStream(string.length()); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(string.getBytes()); gos.close(); compressed = os.toByteArray(); os.close(); ... |
String | convertBpmnVariableValueToXslParam(final Object bpmnVariableValue) Convert a BPMN variable value to a XSL parameter value final String xslParamValue; if (bpmnVariableValue != null) { if (bpmnVariableValue instanceof Date) { final Calendar calendar = Calendar.getInstance(); calendar.setTime((Date) bpmnVariableValue); xslParamValue = DatatypeConverter.printDateTime(calendar); } else { xslParamValue = bpmnVariableValue.toString(); ... |
byte[] | convertToFourBytes(int numberToConvert) Converts a number to four bytes. byte[] numInBytes = new byte[4]; String s1 = Integer.toHexString(numberToConvert); if (s1.length() % 2 != 0) { s1 = "0" + s1; byte[] hexas = DatatypeConverter.parseHexBinary(s1); if (hexas.length == 1) { numInBytes[0] = 0; ... |
String | convertToPEM(PublicKey key) convert To PEM String algo = key.getAlgorithm(); return convertToPEM(algo + " PUBLIC KEY", key); |