/** * Returns a ready to export string representation of the given object.<p> * * For not parseable objects, base64 encoded string with the serialized object is generated.<p> * * @param data the object to export * * @return the string representation * * @throws IOException if something goes wrong */ public static String dataExport(Object data) throws IOException { if (CmsDataTypeUtil.isParseable(data.getClass())) { return CmsDataTypeUtil.format(data); } ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); oout.writeObject(data); oout.close(); return new String(Base64.encodeBase64(bout.toByteArray())); }
/** * Returns the deserialized (if needed) object.<p> * * @param data the data to deserialize * @param type the data type * * @return the deserialized object * * @throws IOException if the inputstream fails * @throws ClassNotFoundException if the serialized object fails */ public static Object dataDeserialize(byte[] data, String type) throws IOException, ClassNotFoundException { // check the type of the stored data Class clazz = Class.forName(type); if (isParseable(clazz)) { // this is parseable data return parse(new String(data), clazz); } // this is a serialized object ByteArrayInputStream bin = new ByteArrayInputStream(data); ObjectInputStream oin = new ObjectInputStream(bin); return oin.readObject(); }
/** * Returns a ready to export string representation of the given object.<p> * * For not parseable objects, base64 encoded string with the serialized object is generated.<p> * * @param data the object to export * * @return the string representation * * @throws IOException if something goes wrong */ public static String dataExport(Object data) throws IOException { if (CmsDataTypeUtil.isParseable(data.getClass())) { return CmsDataTypeUtil.format(data); } ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); oout.writeObject(data); oout.close(); return new String(Base64.encodeBase64(bout.toByteArray())); }
/** * Returns the deserialized (if needed) object.<p> * * @param data the data to deserialize * @param type the data type * * @return the deserialized object * * @throws IOException if the inputstream fails * @throws ClassNotFoundException if the serialized object fails */ public static Object dataDeserialize(byte[] data, String type) throws IOException, ClassNotFoundException { // check the type of the stored data Class<?> clazz = Class.forName(type); if (isParseable(clazz)) { // this is parseable data return parse(new String(data), clazz); } // this is a serialized object ByteArrayInputStream bin = new ByteArrayInputStream(data); ObjectInputStream oin = new ObjectInputStream(bin); return oin.readObject(); }
/** * Returns the import data object.<p> * * @param value the exported value * @param type the expected data type * * @return the import data object * * @throws ClassNotFoundException if something goes wrong * @throws IOException if something goes wrong */ public static Object dataImport(String value, String type) throws ClassNotFoundException, IOException { Class<?> clazz = Class.forName(type); if (CmsDataTypeUtil.isParseable(clazz)) { return CmsDataTypeUtil.parse(value, clazz); } byte[] data = Base64.decodeBase64(value.getBytes()); return dataDeserialize(data, type); }
if (isParseable(data.getClass())) { return format(data).getBytes();
if (isParseable(data.getClass())) { return format(data).getBytes();
Class<?>[] clazz = methods[i].getParameterTypes(); for (int j = 0; j < clazz.length; j++) { if (!CmsDataTypeUtil.isParseable(clazz[j])) {
/** * Returns the import data object.<p> * * @param value the exported value * @param type the expected data type * * @return the import data object * * @throws ClassNotFoundException if something goes wrong * @throws IOException if something goes wrong */ public static Object dataImport(String value, String type) throws ClassNotFoundException, IOException { Class clazz = Class.forName(type); if (CmsDataTypeUtil.isParseable(clazz)) { return CmsDataTypeUtil.parse(value, clazz); } byte[] data = Base64.decodeBase64(value.getBytes()); return dataDeserialize(data, type); }
if (CmsDataTypeUtil.isParseable(entry.getValue().getClass())) { m_addInfoEditable.put(key, entry.getValue()); } else {
Class[] clazz = methods[i].getParameterTypes(); for (int j = 0; j < clazz.length; j++) { if (!CmsDataTypeUtil.isParseable(clazz[j])) {
while (itEntries.hasNext()) { Entry<String, Object> entry = itEntries.next(); if (!CmsDataTypeUtil.isParseable(entry.getValue().getClass())) { String key = entry.getKey().toString(); if (!entry.getValue().getClass().equals(String.class)) {