Package org.mozilla.javascript.serialize

Examples of org.mozilla.javascript.serialize.ScriptableInputStream


     */
    public Object deserialize(InputStream in) throws IOException, ClassNotFoundException {
        core.contextFactory.enterContext();
        engines.set(this);
        try {
            ObjectInputStream sin = new ScriptableInputStream(in, core.global) {
                protected Object resolveObject(Object obj) throws IOException {
                    if (obj instanceof SerializationProxy) {
                        return ((SerializationProxy) obj).getObject(RhinoEngine.this);
                    }
                    return super.resolveObject(obj);
                }
            };
            return sin.readObject();
        } finally {
            Context.exit();
        }
    }
View Full Code Here


          baos.close();
          byte[] serializedData = baos.toByteArray();

          // deserialize
          ByteArrayInputStream bais = new ByteArrayInputStream(serializedData);
          ScriptableInputStream sis = new ScriptableInputStream(bais, globalScope);
          globalScope = (Scriptable) sis.readObject();
          Object continuation = sis.readObject();
          sis.close();
          bais.close();

          Object result = cx.resumeContinuation(continuation, globalScope, 8);
          assertEquals(8, ((Number)result).intValue());
      } finally {
View Full Code Here

          baos.close();
          byte[] serializedData = baos.toByteArray();

          // deserialize
          ByteArrayInputStream bais = new ByteArrayInputStream(serializedData);
          ScriptableInputStream sis = new ScriptableInputStream(bais, globalScope);
          globalScope = (Scriptable) sis.readObject();
          Object continuation = sis.readObject();
          sis.close();
          bais.close();

          Object result = cx.resumeContinuation(continuation, globalScope, 8);
          assertEquals(8, ((Number)result).intValue());
      } finally {
View Full Code Here

          baos.close();
          byte[] serializedData = baos.toByteArray();

          // deserialize
          ByteArrayInputStream bais = new ByteArrayInputStream(serializedData);
          ScriptableInputStream sis = new ScriptableInputStream(bais, globalScope);
          globalScope = (Scriptable) sis.readObject();
          Object continuation = sis.readObject();
          sis.close();
          bais.close();

          Object result = cx.resumeContinuation(continuation, globalScope, 8);
          assertEquals(8, ((Number)result).intValue());
      } finally {
View Full Code Here

          baos.close();
          byte[] serializedData = baos.toByteArray();

          // deserialize
          ByteArrayInputStream bais = new ByteArrayInputStream(serializedData);
          ScriptableInputStream sis = new ScriptableInputStream(bais, globalScope);
          globalScope = (Scriptable) sis.readObject();
          Object continuation = sis.readObject();
          sis.close();
          bais.close();

          Object result = cx.resumeContinuation(continuation, globalScope, "2+3");
          assertEquals(5, ((Number) result).intValue());
      } finally {
View Full Code Here

        Scriptable globalScope = cx.initStandardObjects();
        globalScope.put("myObject", globalScope, Context.javaToJS(new MyClass(), globalScope));

        // deserialize
        ByteArrayInputStream bais = new ByteArrayInputStream(serializedData);
        ScriptableInputStream sis = new ScriptableInputStream(bais, globalScope);
        globalScope = (Scriptable) sis.readObject();
        Object continuation = sis.readObject();
        sis.close();
        bais.close();

        Object result = cx.resumeContinuation(continuation, globalScope, 8);
        assertEquals("foo", result);
      } finally {
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.serialize.ScriptableInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.