Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Rhino serialization code, released
* Sept. 25, 2001.
*
* The Initial Developer of the Original Code is
* Norris Boyd.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Norris Boyd
* Attila Szegedi
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License Version 2 or later (the "GPL"), in which
* case the provisions of the GPL are applicable instead of those above. If
* you wish to allow use of your version of this file only under the terms of
* the GPL and not to allow others to use your version of this file under the
* MPL, indicate your decision by deleting the provisions above and replacing
* them with the notice and other provisions required by the GPL. If you do
* not delete the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* ***** END LICENSE BLOCK ***** */
package org.mozilla.javascript.serialize;
import java.util.Map;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.io.*;
import org.mozilla.javascript.*;
/**
* Class ScriptableOutputStream is an ObjectOutputStream used
* to serialize JavaScript objects and functions. Note that
* compiled functions currently cannot be serialized, only
* interpreted functions. The top-level scope containing the
* object is not written out, but is instead replaced with
* another top-level object when the ScriptableInputStream
* reads in this object. Also, object corresponding to names
* added to the exclude list are not written out but instead
* are looked up during deserialization. This approach avoids
* the creation of duplicate copies of standard objects
* during deserialization.
*
* @author Norris Boyd
*/
// API class
public class ScriptableOutputStream extends ObjectOutputStream {
/**
* ScriptableOutputStream constructor.
* Creates a ScriptableOutputStream for use in serializing
* JavaScript objects. Calls excludeStandardObjectNames.
*
* @param out the OutputStream to write to.
* @param scope the scope containing the object.
*/
public ScriptableOutputStream(OutputStream out, Scriptable scope)
throws IOException
{
super(out);
this.scope = scope;
table = new HashMap