示例#1
0
        private void writeObject(java.io.ObjectOutputStream stream)
        {//throws IOException {
            stream.defaultWriteObject();

            stream.writeObject(getOnlySerializable(systemList));
            stream.writeObject(getOnlySerializable(userList));
        }
示例#2
0
 private void writeObject(java.io.ObjectOutputStream stream)
 {//throws IOException {
     lock (mutex)
     {
         stream.defaultWriteObject();
     }
 }
        //-----------------------------------------------------------------------

        /**
         * Write the buffer out using a custom routine.
         *
         * @param out  the output stream
         * @throws IOException
         */
        private void writeObject(java.io.ObjectOutputStream outJ)
        {//throws IOException {
            outJ.defaultWriteObject();
            outJ.writeInt(size());
            for (java.util.Iterator <Object> it = iterator(); it.hasNext();)
            {
                outJ.writeObject(it.next());
            }
        }
        //-----------------------------------------------------------------------

        /**
         * Serializes the data held in this object to the stream specified.
         * <p>
         * The first java.io.Serializable subclass must call this method from
         * <code>writeObject</code>.
         */
        protected virtual void doWriteObject(java.io.ObjectOutputStream outputStream)
        {//throws IOException {
            // Write the size so we know how many nodes to read back
            outputStream.writeInt(size());
            for (java.util.Iterator <Object> itr = iterator(); itr.hasNext();)
            {
                outputStream.writeObject(itr.next());
            }
        }
        //-----------------------------------------------------------------------

        /**
         * Write the map out using a custom routine.
         * @param out  the output stream
         * @throws IOException
         */
        protected virtual void doWriteObject(java.io.ObjectOutputStream outJ)
        {//throws IOException {
            outJ.writeInt(map.size());
            for (java.util.Iterator <java.util.MapNS.Entry <Object, Object> > it = map.entrySet().iterator(); it.hasNext();)
            {
                java.util.MapNS.Entry <Object, Object> entry = (java.util.MapNS.Entry <Object, Object>)it.next();
                outJ.writeObject(entry.getKey());
                outJ.writeInt(((MutableInteger)entry.getValue()).value);
            }
        }
示例#6
0
        //-----------------------------------------------------------------------

        /**
         * Replaces the superclass method to store the state of this class.
         * <p>
         * Serialization is not one of the JDK's nicest topics. Normal serialization will
         * initialise the superclass before the subclass. Sometimes however, this isn't
         * what you want, as in this case the <code>put()</code> method on read can be
         * affected by subclass state.
         * <p>
         * The solution adopted here is to serialize the state data of this class in
         * this protected method. This method must be called by the
         * <code>writeObject()</code> of the first java.io.Serializable subclass.
         * <p>
         * Subclasses may override if they have a specific field that must be present
         * on read before this implementation will work. Generally, the read determines
         * what must be serialized here, if anything.
         *
         * @param out  the output stream
         */
        protected void dowriteObject(java.io.ObjectOutputStream outJ)
        {//throws IOException {
            outJ.writeInt(keyType);
            outJ.writeInt(valueType);
            outJ.writeBoolean(purgeValues);
            outJ.writeFloat(loadFactor);
            outJ.writeInt(data.Length);
            for (MapIterator it = mapIterator(); it.hasNext();)
            {
                outJ.writeObject(it.next());
                outJ.writeObject(it.getValue());
            }
            outJ.writeObject(null);  // null terminate map
            // do not call base.doWriteObject() as code there doesn't work for reference map
        }
示例#7
0
 private void writeObject(java.io.ObjectOutputStream oos)//throws IOException {
 {
     oos.defaultWriteObject();
     PropertyChangeListener[] gListeners = globalListeners
                                           .toArray(new PropertyChangeListener[0]);
     for (int i = 0; i < gListeners.Length; i++)
     {
         if (gListeners[i] is java.io.Serializable)
         {
             oos.writeObject(gListeners[i]);
         }
     }
     // Denotes end of list
     oos.writeObject(null);
 }
示例#8
0
        private void writeObject(java.io.ObjectOutputStream stream)
        {//throws IOException {
            stream.defaultWriteObject();
            stream.writeObject(backingMap.comparator());
            int size = backingMap.size();

            stream.writeInt(size);
            if (size > 0)
            {
                Iterator <E> it = backingMap.keySet().iterator();
                while (it.hasNext())
                {
                    stream.writeObject(it.next());
                }
            }
        }
示例#9
0
            /**
             * Creates an object using serialization.
             *
             * @return the new object
             */
            public Object create()
            {
                java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(512);
                java.io.ByteArrayInputStream  bais = null;
                try
                {
                    java.io.ObjectOutputStream outJ = new java.io.ObjectOutputStream(baos);
                    outJ.writeObject(iPrototype);

                    bais = new java.io.ByteArrayInputStream(baos.toByteArray());
                    java.io.ObjectInputStream inJ = new java.io.ObjectInputStream(bais);
                    return(inJ.readObject());
                }
                catch (java.lang.ClassNotFoundException ex)
                {
                    throw new FunctorException(ex);
                }
                catch (java.io.IOException ex)
                {
                    throw new FunctorException(ex);
                }
                finally
                {
                    try
                    {
                        if (bais != null)
                        {
                            bais.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        // ignore
                    }
                    try
                    {
                        if (baos != null)
                        {
                            baos.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        // ignore
                    }
                }
            }
示例#10
0
 /*
  * Customized serialization.
  */
 private void writeObject(java.io.ObjectOutputStream outJ)// throws IOException {
 {
     outJ.defaultWriteObject();
     outJ.writeByte(MAJOR);
     outJ.writeByte(MINOR);
     if (null == parameters)
     {
         outJ.writeInt(-1);
     }
     else
     {
         outJ.writeInt(parameters.Length);
         foreach (Object element in parameters)
         {
             outJ.writeObject(null == element ? null : element.toString());
         }
     }
 }
        //-----------------------------------------------------------------------

        /**
         * Write the bag out using a custom routine.
         */
        private void writeObject(java.io.ObjectOutputStream outJ)
        {//throws IOException {
            outJ.defaultWriteObject();
            outJ.writeObject(comparator());
            base.doWriteObject(outJ);
        }
示例#12
0
        //-----------------------------------------------------------------------

        /**
         * Write the collection out using a custom routine.
         *
         * @param out  the output stream
         * @throws IOException
         */
        private void writeObject(java.io.ObjectOutputStream outJ)  //throws IOException {
        {
            outJ.defaultWriteObject();
            outJ.writeObject(collection);
        }
 /**
  * Writes the data necessary for <code>put()</code> to work in deserialization.
  */
 protected virtual void dowriteObject(java.io.ObjectOutputStream outJ)
 {//throws IOException {
     outJ.writeInt(maxSizeJ);
     base.doWriteObject(outJ);
 }
示例#14
0
        //-----------------------------------------------------------------------

        /**
         * Write the map out using a custom routine.
         *
         * @param out  the output stream
         * @throws IOException
         * @since Commons Collections 3.1
         */
        private void writeObject(java.io.ObjectOutputStream outJ)
        {// throws IOException {
            outJ.defaultWriteObject();
            outJ.writeObject(map);
        }
示例#15
0
 /*
  * Writes the state of this object to the stream passed.
  *
  * @param out
  *            the stream to write the state to.
  * @throws IOException
  *             if the stream throws it during the write.
  * @serialData {@code int} - the length of this object. {@code char[]} - the
  *             buffer from this object, which may be larger than the length
  *             field.
  */
 private void writeObject(java.io.ObjectOutputStream outJ) // throws IOException {
 {
     outJ.defaultWriteObject();
     outJ.writeInt(length());
     outJ.writeObject(getValue());
 }
示例#16
0
 /*
  * This method always throws a {@code NotSerializableException}, because
  * this object cannot be serialized,
  */
 private void writeObject(java.io.ObjectOutputStream outJ)
 {//throws IOException {
     throw new java.io.NotSerializableException();
 }
            /**
             * Creates an object using serialization.
             *
             * @return the new object
             */
            public Object create()
            {
                java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(512);
                java.io.ByteArrayInputStream bais = null;
                try
                {
                    java.io.ObjectOutputStream outJ = new java.io.ObjectOutputStream(baos);
                    outJ.writeObject(iPrototype);

                    bais = new java.io.ByteArrayInputStream(baos.toByteArray());
                    java.io.ObjectInputStream inJ = new java.io.ObjectInputStream(bais);
                    return inJ.readObject();

                }
                catch (java.lang.ClassNotFoundException ex)
                {
                    throw new FunctorException(ex);
                }
                catch (java.io.IOException ex)
                {
                    throw new FunctorException(ex);
                }
                finally
                {
                    try
                    {
                        if (bais != null)
                        {
                            bais.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        // ignore
                    }
                    try
                    {
                        if (baos != null)
                        {
                            baos.close();
                        }
                    }
                    catch (java.io.IOException ex)
                    {
                        // ignore
                    }
                }
            }