/** Load a object of type 'clazz' from a file. */ public <T> T load(Class<T> clazz, InputStream is) throws JAXBException { Context context; T object; context = getContext(clazz); synchronized (context) { object = (T) context.unmarshal(is); return object; } }
/** Save a object to a outputstream. */ private void save(Object object, OutputStream os) throws JAXBException, IOException { Writer writer; Context context; writer = new OutputStreamWriter(os); context = getContext(object.getClass()); synchronized (context) { context.marshal(object, writer); } }