/** * Convert a byte array (of an xml) to an object. * @param val The byte array. * @param classloader The class loader. * @return The decoded object. */ public static Object objectFromByteArray(byte[] val, ClassLoader classloader, IErrorReporter rep) { return objectFromByteArray(val, classloader, null, null, rep); }
/** * Decode an object. * @return The decoded object. * @throws IOException */ // public Object decode(byte[] bytes, ClassLoader classloader) public Object decode(Object bytes, ClassLoader classloader) { Object ret = bytes instanceof byte[] ? JavaReader.objectFromByteArray((byte[])bytes, classloader) : JavaReader.objectFromInputStream((InputStream)bytes, classloader); if(DEBUG) System.out.println("decode message: "+(new String((byte[])bytes))); return ret; } }
/** * Decode an object. * @return The decoded object. * @throws IOException */ // public Object decode(byte[] bytes, ClassLoader classloader) public Object decode(Object bytes, ClassLoader classloader, IErrorReporter rep) { Object ret = bytes instanceof byte[] ? JavaReader.objectFromByteArray((byte[])bytes, classloader, rep) : JavaReader.objectFromInputStream((InputStream)bytes, classloader, rep); if(DEBUG) System.out.println("decode message: "+(new String((byte[])bytes, Charset.forName("UTF-8")))); return ret; } }
/** * Decode an object. * @return The decoded object. * @throws IOException */ // public Object decode(byte[] bytes, ClassLoader classloader) public Object decode(Object bytes, ClassLoader classloader, IErrorReporter rep) { Object ret = bytes instanceof byte[] ? JavaReader.objectFromByteArray((byte[])bytes, classloader, rep) : JavaReader.objectFromInputStream((InputStream)bytes, classloader, rep); if(DEBUG) { try { System.out.println("decode message: "+(new String((byte[])bytes, "UTF-8"))); } catch(UnsupportedEncodingException e) { throw new RuntimeException(e); } } return ret; } }
/** * Decode data with the codec. * @param val The string value. * @return The encoded object. */ public Object decode(byte[] val, ClassLoader classloader, Map<Class<?>, Object[]> info, IErrorReporter rep) { Object[] infos = info==null? null: info.get(getClass()); Tuple2<TypeInfoPathManager, IObjectReaderHandler> tup = (Tuple2<TypeInfoPathManager, IObjectReaderHandler>)(infos!=null? infos[0]: null); Object ret = JavaReader.objectFromByteArray(val, classloader, tup==null? null: tup.getFirstEntity(), tup==null? null: tup.getSecondEntity(), rep); if(DEBUG) System.out.println("decode content: "+ret); return ret; } }
/** * Decode data with the codec. * @param val The string value. * @return The encoded object. */ public Object decode(byte[] val, ClassLoader classloader, Map<Class<?>, Object[]> info, IErrorReporter rep) { Object[] infos = info==null? null: info.get(getClass()); Tuple2<TypeInfoPathManager, IObjectReaderHandler> tup = (Tuple2<TypeInfoPathManager, IObjectReaderHandler>)(infos!=null? infos[0]: null); Object ret = JavaReader.objectFromByteArray(val, classloader, tup==null? null: tup.getFirstEntity(), tup==null? null: tup.getSecondEntity(), rep); if(DEBUG) System.out.println("decode content: "+ret); return ret; } }
/** * Decode data with the codec. * @param val The string value. * @return The encoded object. */ public Object decode(byte[] val, ClassLoader classloader, Map<Class<?>, Object[]> info) { Object[] infos = info==null? null: info.get(getClass()); Tuple2<TypeInfoPathManager, IObjectReaderHandler> tup = (Tuple2<TypeInfoPathManager, IObjectReaderHandler>)(infos!=null? infos[0]: null); Object ret = JavaReader.objectFromByteArray(val, classloader, tup==null? null: tup.getFirstEntity(), tup==null? null: tup.getSecondEntity()); if(DEBUG) System.out.println("decode content: "+ret); return ret; } }
info = (AwarenessInfo)JavaReader.objectFromByteArray((byte[])msg.getMessage().get(SFipa.CONTENT), getClass().getClassLoader(), IErrorReporter.IGNORE);