/** * Dump the given object to the given stream, using the appropriate * marshaling method. * * @param stream The stream to which to dump * @param object The object to dump * @throws IOException If there is an IO error during dumping */ public void dump(MarshalStream stream, IRubyObject object) throws IOException { switch (type) { case DEFAULT: stream.writeDirectly(object); return; case NEW_USER: stream.userNewMarshal(object, method); return; case OLD_USER: stream.userMarshal(object, method); return; case DEFAULT_SLOW: if (object.respondsTo("marshal_dump")) { stream.userNewMarshal(object); } else if (object.respondsTo("_dump")) { stream.userMarshal(object); } else { stream.writeDirectly(object); } return; } }
/** * Dump the given object to the given stream, using the appropriate * marshaling method. * * @param stream The stream to which to dump * @param object The object to dump * @throws IOException If there is an IO error during dumping */ public void dump(MarshalStream stream, IRubyObject object) throws IOException { switch (type) { case DEFAULT: stream.writeDirectly(object); return; case NEW_USER: stream.userNewMarshal(object, method); return; case OLD_USER: stream.userMarshal(object, method); return; case DEFAULT_SLOW: if (object.respondsTo("marshal_dump")) { stream.userNewMarshal(object); } else if (object.respondsTo("_dump")) { stream.userMarshal(object); } else { stream.writeDirectly(object); } return; } }
/** * Dump the given object to the given stream, using the appropriate * marshaling method. * * @param stream The stream to which to dump * @param object The object to dump * @throws IOException If there is an IO error during dumping */ public void dump(MarshalStream stream, IRubyObject object) throws IOException { switch (type) { case DEFAULT: stream.writeDirectly(object); return; case NEW_USER: stream.userNewMarshal(object, method); return; case OLD_USER: stream.userMarshal(object, method); return; case DEFAULT_SLOW: if (object.respondsTo("marshal_dump")) { stream.userNewMarshal(object); } else if (object.respondsTo("_dump")) { stream.userMarshal(object); } else { stream.writeDirectly(object); } return; } }
/** * Dump the given object to the given stream, using the appropriate * marshaling method. * * @param stream The stream to which to dump * @param object The object to dump * @throws IOException If there is an IO error during dumping */ public void dump(MarshalStream stream, IRubyObject object) throws IOException { switch (type) { case DEFAULT: stream.writeDirectly(object); return; case NEW_USER: stream.userNewMarshal(object, method); return; case OLD_USER: stream.userMarshal(object, method); return; case DEFAULT_SLOW: if (object.respondsTo("marshal_dump")) { stream.userNewMarshal(object); } else if (object.respondsTo("_dump")) { stream.userMarshal(object); } else { stream.writeDirectly(object); } return; } }