if (log.isLoggable(Level.FINEST)) { PrintWriter dbg = new PrintWriter(new LogWriter(log)); HessianDebugInputStream dIs = new HessianDebugInputStream(is, dbg);
dIs.startTop2();
is = dIs; }
AbstractHessianInput in;
int code = is.read();
if (code == 'H') { int major = is.read(); int minor = is.read();
if (value instanceof InputStream) { value = new ResultInputStream(conn, is, in, (InputStream) value); is = null; conn = null; } else in.completeReply();
returnvalue; } else throw new HessianProtocolException("'" + (char) code + "' is an unknown code"); } catch (HessianProtocolException e) { throw new HessianRuntimeException(e); } finally { try { if (is != null) is.close(); } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } try { if (conn != null) conn.destroy(); } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } } }
/** * Returns the serializer for a class. * * @param cl the class of the object that needs to be serialized. * * @return a serializer object for the serialization. */
public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { switch (_code) { case BOOLEAN: out.writeBoolean(((Boolean) obj).booleanValue()); break; case BYTE: case SHORT: case INTEGER: out.writeInt(((Number) obj).intValue()); break;
case LONG: out.writeLong(((Number) obj).longValue()); break;
case FLOAT: case DOUBLE: out.writeDouble(((Number) obj).doubleValue()); break; case CHARACTER: case CHARACTER_OBJECT: out.writeString(String.valueOf(obj)); break; case STRING: out.writeString((String) obj); break; case DATE: out.writeUTCDate(((Date) obj).getTime()); break; case BOOLEAN_ARRAY: { if (out.addRef(obj)) return; boolean []data = (boolean []) obj; boolean hasEnd = out.writeListBegin(data.length, "[boolean"); for (int i = 0; i < data.length; i++) out.writeBoolean(data[i]);
case SHORT_ARRAY: { if (out.addRef(obj)) return; short []data = (short []) obj; boolean hasEnd = out.writeListBegin(data.length, "[short"); for (int i = 0; i < data.length; i++) out.writeInt(data[i]);
if (hasEnd) out.writeListEnd(); break; }
case INTEGER_ARRAY: { if (out.addRef(obj)) return; int []data = (int []) obj; boolean hasEnd = out.writeListBegin(data.length, "[int"); for (int i = 0; i < data.length; i++) out.writeInt(data[i]);
if (hasEnd) out.writeListEnd(); break; }
case LONG_ARRAY: { if (out.addRef(obj)) return; long []data = (long []) obj; boolean hasEnd = out.writeListBegin(data.length, "[long"); for (int i = 0; i < data.length; i++) out.writeLong(data[i]);
if (hasEnd) out.writeListEnd(); break; }
case FLOAT_ARRAY: { if (out.addRef(obj)) return; float []data = (float []) obj; boolean hasEnd = out.writeListBegin(data.length, "[float"); for (int i = 0; i < data.length; i++) out.writeDouble(data[i]);
if (hasEnd) out.writeListEnd(); break; }
case DOUBLE_ARRAY: { if (out.addRef(obj)) return; double []data = (double []) obj; boolean hasEnd = out.writeListBegin(data.length, "[double"); for (int i = 0; i < data.length; i++) out.writeDouble(data[i]);
if (hasEnd) out.writeListEnd(); break; }
case STRING_ARRAY: { if (out.addRef(obj)) return; String []data = (String []) obj; boolean hasEnd = out.writeListBegin(data.length, "[string"); for (int i = 0; i < data.length; i++) { out.writeString(data[i]); }