Beispiel #1
0
 private IRubyObject userNewUnmarshal() throws IOException {
   String className = unmarshalObject(false).asJavaString();
   RubyClass classInstance = findClass(className);
   IRubyObject result = classInstance.allocate();
   registerLinkTarget(result);
   IRubyObject marshaled = unmarshalObject();
   return classInstance.smartLoadNewUser(result, marshaled);
 }
Beispiel #2
0
        public Object unmarshalFrom(Ruby runtime, RubyClass type, UnmarshalStream unmarshalStream)
            throws IOException {
          RubySystemCallError exc = (RubySystemCallError) type.allocate();

          unmarshalStream.registerLinkTarget(exc);
          unmarshalStream.defaultVariablesUnmarshal(exc);

          exc.message = (IRubyObject) exc.removeInternalVariable("mesg");
          exc.errno = (IRubyObject) exc.removeInternalVariable("errno");
          exc.set_backtrace((IRubyObject) exc.removeInternalVariable("bt"));

          return exc;
        }
Beispiel #3
0
 private IRubyObject userUnmarshal(MarshalState state) throws IOException {
   String className = unmarshalObject(false).asJavaString();
   ByteList marshaled = unmarshalString();
   RubyClass classInstance = findClass(className);
   RubyString data = RubyString.newString(getRuntime(), marshaled);
   if (state.isIvarWaiting()) {
     defaultVariablesUnmarshal(data);
     state.setIvarWaiting(false);
   }
   IRubyObject unmarshaled = classInstance.smartLoadOldUser(data);
   registerLinkTarget(unmarshaled);
   return unmarshaled;
 }
Beispiel #4
0
        public Object unmarshalFrom(Ruby runtime, RubyClass type, UnmarshalStream unmarshalStream)
            throws IOException {
          RubyRange range = (RubyRange) type.allocate();

          unmarshalStream.registerLinkTarget(range);

          unmarshalStream.defaultVariablesUnmarshal(range);

          range.begin = (IRubyObject) range.removeInternalVariable("begin");
          range.end = (IRubyObject) range.removeInternalVariable("end");
          range.isExclusive = ((IRubyObject) range.removeInternalVariable("excl")).isTrue();

          return range;
        }
Beispiel #5
0
 public static RubyFloat unmarshalFrom(UnmarshalStream input) throws java.io.IOException {
   ByteList value = input.unmarshalString();
   RubyFloat result;
   if (value.equals(NAN_BYTELIST)) {
     result = RubyFloat.newFloat(input.getRuntime(), RubyFloat.NAN);
   } else if (value.equals(NEGATIVE_INFINITY_BYTELIST)) {
     result = RubyFloat.newFloat(input.getRuntime(), Double.NEGATIVE_INFINITY);
   } else if (value.equals(INFINITY_BYTELIST)) {
     result = RubyFloat.newFloat(input.getRuntime(), Double.POSITIVE_INFINITY);
   } else {
     result = RubyFloat.newFloat(input.getRuntime(), ConvertDouble.byteListToDouble(value, false));
   }
   input.registerLinkTarget(result);
   return result;
 }