List of usage examples for com.liferay.portal.kernel.util UnicodeFormatter hexToBytes
public static byte[] hexToBytes(String hexString)
From source file:com.liferay.marketplace.util.MarketplaceUtil.java
License:Open Source License
public static String decodeClientId(String encodedClientId, String token) { if (Validator.isNull(encodedClientId) || Validator.isNull(token)) { return StringPool.BLANK; }/* ww w. j ava 2 s.c om*/ byte[] encodedClientIdBytes = UnicodeFormatter.hexToBytes(encodedClientId); if (encodedClientIdBytes.length == 0) { return StringPool.BLANK; } return new String(xor(encodedClientIdBytes, token.getBytes())); }
From source file:com.liferay.portlet.journal.action.ActionUtil.java
License:Open Source License
protected static Map<String, byte[]> getImages(Fields fields, Locale locale) throws Exception { Map<String, byte[]> images = new HashMap<String, byte[]>(); for (Field field : fields) { String dataType = field.getDataType(); if (!dataType.equals(FieldConstants.IMAGE)) { continue; }//from w w w.ja va 2 s . c o m List<Serializable> values = field.getValues(locale); for (int i = 0; i < values.size(); i++) { String content = (String) values.get(i); if (content.equals("update")) { continue; } StringBundler sb = new StringBundler(6); sb.append(StringPool.UNDERLINE); sb.append(field.getName()); sb.append(StringPool.UNDERLINE); sb.append(i); sb.append(StringPool.UNDERLINE); sb.append(LanguageUtil.getLanguageId(locale)); images.put(sb.toString(), UnicodeFormatter.hexToBytes(content)); } } return images; }