/** * Convert a byte array (of an xml) to an object. * @param val The input stream. * @param classloader The class loader. * @return The decoded object. */ public static Object objectFromInputStream(InputStream val, ClassLoader classloader, IErrorReporter rep) { return objectFromInputStream(val, classloader, null, null, rep); }
/** * Read the object from the */ public Object readFrom(Class<Object> type, Type generictype, Annotation[] annotations, MediaType mediatype, MultivaluedMap<String, String> httpheaders, InputStream entitystream) throws IOException, WebApplicationException { try { return JavaReader.objectFromInputStream(entitystream, Thread.currentThread().getContextClassLoader(), null); } catch(Exception e) { return null; } } }
/** * Read the object from the */ public Object readFrom(Class<Object> type, Type generictype, Annotation[] annotations, MediaType mediatype, MultivaluedMap<String, String> httpheaders, InputStream entitystream) throws IOException, WebApplicationException { try { return JavaReader.objectFromInputStream(entitystream, Thread.currentThread().getContextClassLoader(), null); } catch(Exception e) { return null; } } }
/** * 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) { 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) { try { System.out.println("decode message: "+(new String((byte[])bytes, "UTF-8"))); } catch(UnsupportedEncodingException e) { throw new RuntimeException(e); } } return ret; } }