/*
(non-Javadoc)

@see SimplifiedSerialization.readObject(java.io.DataInputStream,ObjectManagerState)
353549
public void readObject(java.io.DataInputStream dataInputStream,
                           ObjectManagerState objectManagerState)
                    throws ObjectManagerException {
        final String methodName = "readObject";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        methodName,
                        new Object[] { dataInputStream,
                                      objectManagerState });

        try {
            byte version = dataInputStream.readByte();
            if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
                trace.debug(this,
                            cclass,
                            methodName,
                            new Object[] { new Byte(version) });
            super.readObject(dataInputStream,
                             objectManagerState);
            if (dataInputStream.readByte() == 1) {
                // The first element in the list.
                head = Token.restore(dataInputStream,
                                     objectManagerState);
                //      The final element in the list.
                tail = Token.restore(dataInputStream,
                                     objectManagerState);
            } // if (dataInputStream.readByte() == 1).
            size = dataInputStream.readLong();
        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this,
                                                cclass,
                                                methodName,
                                                exception,
                                                "1:1620:1.40");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this,
                           cclass,
                           methodName,
                           new Object[] { exception });
            throw new PermanentIOException(this,
                                           exception);
        } // catch (java.io.IOException exception).

        // We cannot set the available head during recovery because the links may get deleted before
        // recovery is complete, instead force a scan when we use availableHead for the first time.
        availableHead = null;
        availableSize = size; // All links are initially available.

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
476687
private void readObject(java.io.ObjectInputStream s)
        throws java.io.IOException, ClassNotFoundException {
        s.defaultReadObject();
        for (;;) {
            @SuppressWarnings("unchecked")
            E item = (E) s.readObject();
            if (item == null)
                break;
            else
                offer(item);
        }
    }
879062
public void readObject (ObjectInputStream in)
        throws IOException, ClassNotFoundException
    {
        _size = in.readInt();
        // ensure our capacity is a power of 2 (for consistency)
        int capacity = INITIAL_CAPACITY;
        while (capacity < _size) {
            capacity <<= 1;
        }
        @SuppressWarnings("unchecked") E[] entries = (E[])new Entry[capacity];
        _entries = entries;
        for (int ii = 0; ii < _size; ii++) {
            @SuppressWarnings("unchecked") E entry = (E)in.readObject();
            _entries[ii] = entry;
        }
    }
231900
private void readObject(java.io.ObjectInputStream s)
      throws java.io.IOException, ClassNotFoundException {
    s.defaultReadObject();

    // Read in array length and allocate array
    int length = s.readInt();
    this.longs = new AtomicLongArray(length);

    // Read in all elements in the proper order.
    for (int i = 0; i < length; i++) {
      set(i, s.readDouble());
    }
  }
850579
public final void writeObject(java.io.DataOutputStream dataOutputStream)
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass,
                        "writeObject",
                        "dataOutputStream=" + dataOutputStream);

        try {
            dataOutputStream.writeByte(SimpleSerialVersion);
            super.writeObject(dataOutputStream);

            dataOutputStream.writeInt(activeSubListCount);
            for (int i = 0; i < subListTokens.length; i++) {
                subListTokens[i].writeObject(dataOutputStream);
            } // for subLists.

        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this,
                                                cclass,
                                                "writeObject",
                                                exception,
                                                "1:1229:1.26");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this, cclass
                           , "writeObject"
                           , "via PermanentIOException"
                                );
            throw new PermanentIOException(this,
                                           exception);
        } // catch (java.io.IOException exception).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass,
                       "writeObject");
    }
752008
private void readObject(java.io.ObjectInputStream in)
                    throws IOException, ClassNotFoundException
    {
        in.defaultReadObject();

        byte[] tempEyeCatcher = new byte[Constants.EYE_CATCHER_LENGTH];

        // d164415 start
        int bytesRead = 0;
        for (int offset = 0; offset < Constants.EYE_CATCHER_LENGTH; offset += bytesRead)
        {
            bytesRead = in.read(tempEyeCatcher, offset, Constants.EYE_CATCHER_LENGTH - offset);
            if (bytesRead == -1)
            {
                throw new IOException("end of input stream while reading eye catcher");
            }
        } // d164415 end

        for (int i = 0; i < EYECATCHER.length; i++)
        {
            if (tempEyeCatcher[i] != EYECATCHER[i])
            {
                String eyeCatcherString = new String(tempEyeCatcher);
                throw new IOException("Invalid eye catcher '" + eyeCatcherString +
                                      "' in handle input stream");
            }
        }

        // Get websphere platform and version ID from header.
        in.readShort(); // platform
        ivActualVersion = in.readShort();
        //d158086 added version checking
        if ((ivActualVersion != Constants.HOME_HANDLE_V1) && (ivActualVersion != Constants.HOME_HANDLE_V2))
        {
            throw new java.io.InvalidObjectException("Home Handle data stream is not of the correct version, this client should be updated.");
        }
        //d158086

        // Use HandleDelegate object to read in EJBHome object.

        //d164668 allow 2nd change for type 1 home handles if stub doesn't connect use jndi logic

        try {
            ivEjbHome = HandleHelper.lookupHandleDelegate().readEJBHome(in);
        } catch (IOException ioe)
        {
            // FFDCFilter.processException(t, CLASS_NAME + "readObject", "335", this);

            if (ivActualVersion != Constants.HOME_HANDLE_V1)
            {
                throw ioe;
            }
        }

        if (ivActualVersion == Constants.HOME_HANDLE_V1)
        {
            ivInitialContextProperties = (Properties) in.readObject();
            ivHomeInterface = in.readUTF();
            ivJndiName = in.readUTF();

            // Null out the reference since we do not have a portable way
            // to determine if we got reference from the ORB and the version ID
            // indicates this is a non-robust  handle.  So, we need to force the
            // getEJBHome method to get a new reference by doing a JNDI lookup.
            ivEjbHome = null; //p125891
        }
    }
445235
protected void writeObject(java.io.DataOutputStream dataOutputStream)
                    throws ObjectManagerException, java.io.IOException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this
                        , cclass
                        , "writeObject"
                        , new Object[] { dataOutputStream }
                            );

        try {
            dataOutputStream.writeByte(simpleSerialVersion);

        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, "writeObject", exception, "1:2111:1.34");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this
                           , cclass
                           , "writeObject"
                           , "via PermanentIOException"
                                );
            throw new PermanentIOException(this,
                                           exception);
        } // catch (java.io.IOException exception).

        // We cannot check size as we are subclassed.

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "writeObject");
    }
106082
@SuppressWarnings("unchecked")
    private void readObject(java.io.ObjectInputStream s)
        throws java.io.IOException, ClassNotFoundException
    {
        // Read in the key type and any hidden stuff
        s.defaultReadObject();

        keyUniverse = getKeyUniverse(keyType);
        vals = new Object[keyUniverse.length];

        // Read in size (number of Mappings)
        int size = s.readInt();

        // Read the keys and values, and put the mappings in the HashMap
        for (int i = 0; i < size; i++) {
            K key = (K) s.readObject();
            V value = (V) s.readObject();
            put(key, value);
        }
    }
119934
private void readObject(ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException {
        throw new UnsupportedOperationException(); // not serializable
    }
1290867
private void readObject(java.io.ObjectInputStream objectInputStream)
                    throws java.io.IOException
                    , java.lang.ClassNotFoundException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass,
                        "readObject",
                        "objectInputStream=" + objectInputStream + "(java.io.ObjectInputStream)");

        objectInputStream.defaultReadObject();
        // We cannot set the available head during recovery because the links may get deleted before
        // recovery is complete, instead force a scan when we use availableHead for the first time.    
        availableHead = null;
        availableSize = size; // All links are initially available.
        availableSizeLock = new Object();
        managedObjectsToAdd = new java.util.ArrayList(1);
        managedObjectsToReplace = new java.util.ArrayList(3);
        tokensToNotify = new java.util.ArrayList(1);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass,
                       "readObject");
    }
1275252
public synchronized void open(ObjectManagerState objectManagerState)
                    throws ObjectManagerException {
        final String methodName = "open";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName, new Object[] { objectManagerState });

        super.open(objectManagerState);
        usesSerializedForm = false;

        // Lock all ManagedObjects into memory.
        inMemoryManagedObjects = new ConcurrentHashMap(concurrency);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }
245548
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		in.defaultReadObject();

		// may be null if this serializer was deserialized from an older version
		if (this.values == null) {
			this.values = enumClass.getEnumConstants();

			this.valueToOrdinal = new EnumMap<>(this.enumClass);
			int i = 0;
			for (T value : values) {
				this.valueToOrdinal.put(value, i++);
			}
		}
	}
969947
@SuppressWarnings("unchecked")
    void read(ObjectInputStream in) throws ClassNotFoundException, IOException {
        GetField fields = in.readFields();

        internalPropNames = (Set<String>) fields.get(INTERNAL_PROP_NAMES, null);

        byte[] bytes = (byte[]) fields.get(OBJECT, null);

        // TODO: for internal usage, find a way to supply the class loader of the bundle that creates the contextual object?

        DeserializationObjectInputStream doin = new DeserializationObjectInputStream(
                        new ByteArrayInputStream(bytes),
                        AccessController.doPrivileged(getThreadContextClassLoader));
        object = (T) doin.readObject();
        doin.close();

        Map<String, String> execProps = (Map<String, String>) fields.get(EXEC_PROPS, null);

        bytes = (byte[]) fields.get(CONTEXT, null);
        threadContextDescriptor = (ThreadContextDescriptorImpl) ThreadContextDeserializer.deserialize(bytes, execProps);
    }
657387
@Override
    public void readObject(DataInputStream dataInputStream, ObjectManagerState objectManagerState) throws ObjectManagerException, IOException
    {
    	final String methodName = "readObject";
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, methodName, "bytes available==" + dataInputStream.available());

        super.readObject(dataInputStream, objectManagerState);

        long serialVersionUIDRead = dataInputStream.readLong();
       
        _uniqueID = dataInputStream.readLong();
        _streamID = dataInputStream.readLong();
        _lockID = dataInputStream.readLong();
        _referredID = dataInputStream.readLong();
        _sequence = dataInputStream.readLong();
        _expiryTime = dataInputStream.readLong();

        // redeliveredCount was added for serialVersionUIDV1 and later.
        // otherwise set it to 0.
        if (serialVersionUIDRead == serialVersionUIDV0)
          _redeliveredCount = 0;
        else
          _redeliveredCount = dataInputStream.readInt();

        _storageStrategy = dataInputStream.readInt();
        _priority = dataInputStream.readInt();
        _persistentSize = dataInputStream.readInt();
        _maxDepth = dataInputStream.readInt();

        _canExpireSilently = dataInputStream.readBoolean();
        _containsExpirables = dataInputStream.readBoolean();

        // Read the strings in but only if they were
        // not null on the write.
        boolean read = dataInputStream.readBoolean();
        if (read)
        {
            _type = dataInputStream.readUTF();
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _className = dataInputStream.readUTF();
        }

        // In order to read in the tran ID we need to read
        // its length so we can create the byte array.
        int length = dataInputStream.readInt();

        if (length != -1)
        {
            _transactionId = new byte[length];

            dataInputStream.readFully(_transactionId, 0, length);
        }

        // Call the Tokens to read themselves in but
        // only if the flag preceding them says that
        // they exist in the stream.
        read = dataInputStream.readBoolean();
        if (read)
        {
            _streamListToken = Token.restore(dataInputStream, objectManagerState);
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _itemListToken = Token.restore(dataInputStream, objectManagerState);
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _rawDataToken = Token.restore(dataInputStream, objectManagerState);
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _streamListEntryToken = Token.restore(dataInputStream, objectManagerState);
        }
        read = dataInputStream.readBoolean();
        if (read)
        {
            _itemListEntryToken = Token.restore(dataInputStream, objectManagerState);
        }

        // _deliveryDelayTime was added for serialVersionUID=2 and serialVersionUIDV1 
        // in releases 8.5.6 and higher.
        if (serialVersionUIDRead == serialVersionUIDV0) {
        	_deliveryDelayTime = 0;
        } else if (serialVersionUIDRead == serialVersionUIDV1) {
        	
        	// _deliveryDelayTime was initially added without changing serialVersionUID, so 
        	// PersistableMetaData was stored using serialVersionUIDV1 and may or may not contain 
        	// _deliveryDelayTime. If there are fewer than 8 bytes remaining in the dataInputStream 
        	// then we can safely assume the _deliveryDelayTime was not stored.
            if (dataInputStream.available() >= 8 && _className.equals("com.ibm.ws.sib.processor.impl.store.items.MessageItem")) {
                _deliveryDelayTime = dataInputStream.readLong();
                // We could have just read garbage from spare space in the ObjectStore.
                _deliveryDelayTimeIsSuspect = true;
            }
            else 
        	    _deliveryDelayTime = 0;  
        } else {
        	_deliveryDelayTime = dataInputStream.readLong();
        }

        // Reset _estimatedLength so that it is re-calculated
        // when it is needed.
        _estimatedLength = -1;
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, methodName, "serialVersionUIDRead="+serialVersionUIDRead+" bytes available==" + dataInputStream.available());
    }
1216495
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException {
    int size, expectedMaxSize;
    Object o;

    expectedMaxSize = s.readInt();
    size = s.readInt();

    map = new IdentityHashMap<E, Boolean>(expectedMaxSize);
    for (int i = 0; i < size; i++) {
      o = s.readObject();
      internalAdd(ErasureUtils.<E>uncheckedCast(o));
    }
  }
1140778
private void readObject(java.io.ObjectInputStream objectInputStream)
                    throws java.io.IOException
                    , java.lang.ClassNotFoundException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass,
                        "readObject",
                        "ObjectInputStream="
                                        + objectInputStream);

        // Super class already handled by serilaization.
        objectInputStream.defaultReadObject();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass,
                       "readObject"
                       , "via UnsupportedOperationException");
        throw new UnsupportedOperationException();
    }
125960
private void readObject(ObjectInputStream in) throws ClassNotFoundException, NoSuchMethodException, IOException {
        type = ClassRef.read(in);
        name = in.readUTF();
        val = in.readObject();
    }