@Override @SuppressWarnings("unchecked") public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException { return (T) mH2i.readObject(cls); }
readObjectDefinition(null); return readObject();
/** * Reads an arbitrary object from the input stream when the type * is unknown. */ @Override public Object readObject() throws IOException { return readObject((List<Class<?>>) null); }
@Override public Object readObject(Class expectedClass, Class<?>... expectedTypes) throws IOException { if (expectedClass == null || expectedClass == Object.class) return readObject(); readObjectDefinition(expectedClass); return readObject(expectedClass);
/** * Reads an object from the input stream with an expected type. */ @Override public Object readObject(Class cl) throws IOException { return readObject(cl, null, null); }
@Override @SuppressWarnings("unchecked") public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException { return (T) mH2i.readObject(cls); }
@Override public Object readObject() throws IOException { return mH2i.readObject(); }
@Override public Object readObject() throws IOException { return mH2i.readObject(); }
public Object readStreamingObject() throws IOException { if (_refs != null) _refs.clear(); return readObject(); }
/** * Reads a fault. */ private HashMap readFault() throws IOException { HashMap map = new HashMap(); int code = read(); for (; code > 0 && code != 'Z'; code = read()) { _offset--; Object key = readObject(); Object value = readObject(); if (key != null && value != null) map.put(key, value); } if (code != 'Z') throw expect("fault", code); return map; }
protected IOException expect(String expect, int ch) throws IOException { if (ch < 0) return error("expected " + expect + " at end of file"); else { _offset--; try { Object obj = readObject(); if (obj != null) { return error("expected " + expect + " at 0x" + Integer.toHexString(ch & 0xff) + " " + obj.getClass().getName() + " (" + obj + ")"); } else return error("expected " + expect + " at 0x" + Integer.toHexString(ch & 0xff) + " null"); } catch (IOException e) { log.log(Level.FINE, e.toString(), e); return error("expected " + expect + " at 0x" + Integer.toHexString(ch & 0xff)); } } }
/** * Reads a reply as an object. * If the reply has a fault, throws the exception. */ @Override public Object readReply(Class expectedClass) throws Throwable { int tag = read(); if (tag == 'R') return readObject(expectedClass); else if (tag == 'F') { HashMap map = (HashMap) readObject(HashMap.class); throw prepareFault(map); } else { StringBuilder sb = new StringBuilder(); sb.append((char) tag); try { int ch; while ((ch = read()) >= 0) { sb.append((char) ch); } } catch (IOException e) { log.log(Level.FINE, e.toString(), e); } throw error("expected hessian reply at " + codeName(tag) + "\n" + sb); } }
@SuppressWarnings("unchecked") public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException { return (T) mH2i.readObject(cls); }
/** * Reads an arbitrary object from the input stream when the type * is unknown. */ @Override public Object readObject() throws IOException { return readObject((List<Class<?>>) null); }
@Override @SuppressWarnings("unchecked") public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException { return (T) mH2i.readObject(cls); }
@Override @SuppressWarnings("unchecked") public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException { return (T) mH2i.readObject(cls); }
/** * Reads an object from the input stream with an expected type. */ @Override public Object readObject(Class cl) throws IOException { return readObject(cl, null, null); }
@Override @SuppressWarnings("unchecked") public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException { return (T) mH2i.readObject(cls); }
/** * Reads an arbitrary object from the input stream when the type * is unknown. */ @Override public Object readObject() throws IOException { return readObject((List<Class<?>>) null); }
private Object deserializeObject(byte[] buf) throws IOException { ByteArrayInputStream is = new ByteArrayInputStream(buf); Hessian2Input hin = new Hessian2Input(is); Object object = hin.readObject(); hin.close(); is.close(); return object; }