List of usage examples for org.apache.commons.codec.binary Base64 decodeBase64
public static byte[] decodeBase64(final byte[] base64Data)
From source file:com.scf.utils.UUIDUtilies.java
public static String decodeBase64Uuid(String compressedUuid) { byte[] byUuid = Base64.decodeBase64(compressedUuid); ByteBuffer bb = ByteBuffer.wrap(byUuid); UUID uuid = new UUID(bb.getLong(), bb.getLong()); return uuid.toString(); }
From source file:com.thoughtworks.go.agent.common.util.HeaderUtil.java
public static Map<String, String> parseExtraProperties(Header extraPropertiesHeader) { if (extraPropertiesHeader == null || StringUtils.isBlank(extraPropertiesHeader.getValue())) { return new HashMap<>(); }/* w ww. j a v a2 s.co m*/ try { final String headerValue = new String(Base64.decodeBase64(extraPropertiesHeader.getValue()), UTF_8); if (StringUtils.isBlank(headerValue)) { return new HashMap<>(); } return Arrays.stream(headerValue.trim().split(" +")).map(property -> property.split("=")) .collect(Collectors.toMap(keyAndValue -> keyAndValue[0].replaceAll("%20", " "), keyAndValue -> keyAndValue[1].replaceAll("%20", " "), (value1, value2) -> value1, LinkedHashMap::new)); } catch (Exception e) { LOGGER.warn("Failed to parse extra properties header value: {}", extraPropertiesHeader.getValue(), e); return new HashMap<>(); } }
From source file:com.bjwg.back.util.EncodeUtils.java
public static byte[] decodeBase64(String input) { return Base64.decodeBase64(input); }
From source file:com.eviware.soapui.impl.wsdl.support.CompressedStringSupport.java
public static String getString(CompressedStringConfig compressedStringConfig) { synchronized (compressedStringConfig) { String compression = compressedStringConfig.getCompression(); if ("gzip".equals(compression)) { try { byte[] bytes = Base64.decodeBase64(compressedStringConfig.getStringValue().getBytes()); GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(bytes)); return Tools.readAll(in, -1).toString(); } catch (IOException e) { SoapUI.logError(e);/*from ww w.jav a 2 s .com*/ } } return compressedStringConfig.getStringValue(); } }
From source file:fi.aalto.seqpig.filter.CoordinateFilter.java
protected void decodeSAMFileHeader() { try {//from ww w . j a v a 2 s .c o m Base64 codec = new Base64(); Properties p = UDFContext.getUDFContext().getUDFProperties(this.getClass()); String datastr; datastr = p.getProperty("samfileheader"); byte[] buffer = codec.decodeBase64(datastr); ByteArrayInputStream bstream = new ByteArrayInputStream(buffer); ObjectInputStream ostream = new ObjectInputStream(bstream); this.samfileheader = (String) ostream.readObject(); } catch (Exception e) { } this.samfileheader_decoded = getSAMFileHeader(); }
From source file:com.google.step2.util.EncodingUtil.java
public static byte[] decodeBase64(String b64) { return Base64.decodeBase64(getUtf8Bytes(b64)); }
From source file:hudson.util.Scrambler.java
public static String descramble(String scrambled) { if (scrambled == null) { return null; }//from ww w .java 2 s. c om try { return new String(Base64.decodeBase64(scrambled), "UTF-8"); } catch (IOException e) { return ""; // corrupted data. } }
From source file:com.amazonaws.cognito.sync.devauth.client.AESEncryption.java
/** * Decrypt a string with given key./*from w ww . j a v a2 s. c o m*/ * * @param cipherText encrypted string * @param key the key used in decryption * @return a decrypted string */ public static String unwrap(String cipherText, String key) throws Exception { byte[] dataToDecrypt = Base64.decodeBase64(cipherText.getBytes()); byte[] initializationVector = new byte[16]; byte[] data = new byte[dataToDecrypt.length - 16]; System.arraycopy(dataToDecrypt, 0, initializationVector, 0, 16); System.arraycopy(dataToDecrypt, 16, data, 0, dataToDecrypt.length - 16); byte[] plainText = decrypt(data, key, initializationVector); return new String(plainText); }
From source file:com.spectralogic.ds3client.utils.hashing.Md5Hash.java
public static Md5Hash fromBase64String(final String base64) { return new Md5Hash(Base64.decodeBase64(base64)); }
From source file:com.strategicgains.docussandra.ParseUtils.java
/** * Converts a base64 encoded string to a ByteBuffer. * * @param in Base64 encoded string./* w ww. ja va 2 s.co m*/ * @return A ByteBuffer containing the decoded string. */ public static ByteBuffer parseBase64StringAsByteBuffer(String in) { return ByteBuffer.wrap(Base64.decodeBase64(in.getBytes())); }