/**
         * Read the map in using a custom routine.
         * @param map  the map to use
         * @param in  the input stream
         * @throws IOException
         * @throws ClassNotFoundException
         */
        protected virtual void doReadObject(java.util.Map <Object, Object> map, java.io.ObjectInputStream inJ)
        {// throws IOException, ClassNotFoundException {
            this.map = map;
            int entrySize = inJ.readInt();

            for (int i = 0; i < entrySize; i++)
            {
                Object obj   = inJ.readObject();
                int    count = inJ.readInt();
                map.put(obj, new MutableInteger(count));
                sizeJ += count;
            }
        }
Ejemplo n.º 2
0
        /*
         * Customized deserialization.
         */
        private void readObject(java.io.ObjectInputStream inJ)//throws IOException,            ClassNotFoundException {
        {
            inJ.defaultReadObject();
            byte major = inJ.readByte();
            byte minor = inJ.readByte();

            // only check MAJOR version
            if (major != MAJOR)
            {
                // logging.5=Different version - {0}.{1}
                throw new java.io.IOException("Different version - " + //$NON-NLS-1$
                                              java.lang.Byte.valueOf(major) + "." + java.lang.Byte.valueOf(minor));
            }

            int length = inJ.readInt();

            if (length >= 0)
            {
                parameters = new Object[length];
                for (int i = 0; i < parameters.Length; i++)
                {
                    parameters[i] = inJ.readObject();
                }
            }
            if (null != resourceBundleName)
            {
                try {
                    resourceBundle = Logger.loadResourceBundle(resourceBundleName);
                } catch (MissingResourceException e) {
                    // Cannot find the specified resource bundle
                    resourceBundle = null;
                }
            }
        }
Ejemplo n.º 3
0
        /*
         * Reads the state of a {@code StringBuilder} from the passed stream and
         * restores it to this instance.
         *
         * @param in
         *            the stream to read the state from.
         * @throws IOException
         *             if the stream throws it during the read.
         * @throws ClassNotFoundException
         *             if the stream throws it during the read.
         */
        private void readObject(java.io.ObjectInputStream inJ)  //throws IOException,
        //ClassNotFoundException {
        {
            inJ.defaultReadObject();
            int count = inJ.readInt();

            char[] value = (char[])inJ.readObject();
            set(value, count);
        }
        /**
         * Deserializes the data held in this object to the stream specified.
         * <p>
         * The first java.io.Serializable subclass must call this method from
         * <code>readObject</code>.
         */
        protected virtual void doReadObject(java.io.ObjectInputStream inputStream)
        {//throws IOException, ClassNotFoundException {
            init();
            int size = inputStream.readInt();

            for (int i = 0; i < size; i++)
            {
                add(inputStream.readObject());
            }
        }
        /**
         * Read the buffer in using a custom routine.
         *
         * @param in  the input stream
         * @throws IOException
         * @throws ClassNotFoundException
         */
        private void readObject(java.io.ObjectInputStream inJ)
        {//throws IOException, ClassNotFoundException {
            inJ.defaultReadObject();
            int size = inJ.readInt();

            buffer = new Object[size + 1];
            for (int i = 0; i < size; i++)
            {
                buffer[i] = inJ.readObject();
            }
            head = 0;
            tail = size;
        }
Ejemplo n.º 6
0
        /**
         * Replaces the superclassm method to read 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 deserialize the state data of this class in
         * this protected method. This method must be called by the
         * <code>readObject()</code> of the first java.io.Serializable subclass.
         * <p>
         * Subclasses may override if the subclass has a specific field that must be present
         * before <code>put()</code> or <code>calculateThreshold()</code> will work correctly.
         *
         * @param in  the input stream
         */
        protected void doreadObject(java.io.ObjectInputStream inJ)
        {//throws IOException, ClassNotFoundException {
            this.keyType     = inJ.readInt();
            this.valueType   = inJ.readInt();
            this.purgeValues = inJ.readBoolean();
            this.loadFactor  = inJ.readFloat();
            int capacity = inJ.readInt();

            init();
            data = new HashEntry[capacity];
            while (true)
            {
                Object key = inJ.readObject();
                if (key == null)
                {
                    break;
                }
                Object value = inJ.readObject();
                put(key, value);
            }
            threshold = calculateThreshold(data.Length, loadFactor);
            // do not call base.doReadObject() as code there doesn't work for reference map
        }
Ejemplo n.º 7
0
 private void readObject(java.io.ObjectInputStream stream)
 {//throws IOException,ClassNotFoundException
     {
         stream.defaultReadObject();
         TreeMap <E, Object> map = new TreeMap <E, Object>(
             (Comparator <E>)stream.readObject());
         int size = stream.readInt();
         if (size > 0)
         {
             TreeMap <E, Object> .Node <E, Object> lastNode = null;
             for (int i = 0; i < size; i++)
             {
                 E elem = (E)stream.readObject();
                 lastNode = map.addToLast(lastNode, elem, java.lang.Boolean.TRUE);
             }
         }
         backingMap = map;
     }
 }
Ejemplo n.º 8
0
        /**
         * Read the buffer in using a custom routine.
         *
         * @param in  the input stream
         * @throws IOException
         * @throws ClassNotFoundException
         */
        private void readObject(java.io.ObjectInputStream inJ)
        {//throws IOException, ClassNotFoundException {
            inJ.defaultReadObject();
            elements = new Object[maxElements];
            int size = inJ.readInt();

            for (int i = 0; i < size; i++)
            {
                elements[i] = inJ.readObject();
            }
            start = 0;
            full  = (size == maxElements);
            if (full)
            {
                end = 0;
            }
            else
            {
                end = size;
            }
        }
 /**
  * Reads the data necessary for <code>put()</code> to work in the superclass.
  */
 protected virtual void doreadObject(java.io.ObjectInputStream inJ)
 {//throws IOException, ClassNotFoundException {
     maxSizeJ = inJ.readInt();
     base.doReadObject(inJ);
 }