Reconstitutes this object from a stream.

@param stream object input stream
763450
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        stream.defaultReadObject();
        this.era = JapaneseEra.from(isoDate);
        int yearOffset = this.era.startDate().getYear() - 1;
        this.yearOfEra = isoDate.getYear() - yearOffset;
    }
133741
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        // instantiate persistent variables
        stream.defaultReadObject();
        // initialize the non-null transient variables
        cachedEncoding = new byte[EncodingLevel.values().length][];
    }
878652
public static Map<String, Object> read(InputStream stream)
		throws IOException
	{
		ConfigJsonInput input = new ConfigJsonInput(new InputStreamReader(stream, StandardCharsets.UTF_8));
		return read(input);
	}
1060943
private void copyToStream(String txt, OutputStream stream) throws IOException {
        if (txt != null) {
            stream.write(txt.getBytes());
        }
    }
858060
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		in.defaultReadObject();
		if (this.root != null) {
			this.root.removeFromParent();
			this.root.addTreeNodeListener(this.listener);
		}
	}
565570
public void reconstitute(
    MessageProcessor processor, 
    HashMap durableSubscriptionsTable,
    int startMode) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "reconstitute", 
        new Object[] { processor, durableSubscriptionsTable, Integer.valueOf(startMode) });
        
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
      SibTr.debug(tc, "Reconstituting MQLink " + getName());
   
    try 
    {
      super.reconstitute(processor, durableSubscriptionsTable, startMode);

      // Check Removed.
//      if(!isToBeDeleted())
//      {                
        // There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
        if (_mqLinkStateItemStreamId != 0)
        {
          _mqLinkStateItemStream 
            = (ItemStream) findById(_mqLinkStateItemStreamId);
             
          // A MQLinkHandler must have a MQLinkStateItemStream as long as the destination
          // is not in delete state.  The ME may have restarted and the item stream already 
          // deleted
          if (_mqLinkStateItemStream == null && !isToBeDeleted())
          {
            SIResourceException e =
              new SIResourceException(
                nls.getFormattedMessage(
                  "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
                  new Object[] { getName() },
                  null));
                
            SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() });
      
            FFDCFilter.processException(
              e,
              "com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
              "1:270:1.71",
              this);
      
            SibTr.exception(tc, e);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
              SibTr.exit(tc, "reconstitute", e);
            throw e;
          }
        }
  
        // There should only be one MQLinkStateItemStream in the MQLinkLocalizationItemStream.
        NonLockingCursor cursor = newNonLockingItemStreamCursor(
          new ClassEqualsFilter(MQLinkPubSubBridgeItemStream.class));
        _mqLinkPubSubBridgeItemStream = (MQLinkPubSubBridgeItemStream)cursor.next();
        
        // A MQLinkLocalizationItemStream should not be in the DestinationManager
        // without a MQLinkStateItemStream as long as the destination
        // is not in delete state.  The ME may have restarted and the item stream already 
        // deleted
        if (_mqLinkPubSubBridgeItemStream == null && !isToBeDeleted())
        {
          SIResourceException e =
             new SIResourceException(
              nls.getFormattedMessage(
                "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049",
                new Object[] { getName() },
                null));

          SibTr.error(tc, "LINK_HANDLER_RECOVERY_ERROR_CWSIP0049", new Object[] { getName() });
    
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
            "1:303:1.71",
            this);
    
          SibTr.exception(tc, e);
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
            SibTr.exit(tc, "reconstitute", e);
          throw e;
        }
      
        cursor.finished();
/*      }
      else
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          SibTr.debug(tc, "MQLink marked to be deleted, bypass state stream integrity checks");
      }*/          
    }
    catch (Exception e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.MQLinkHandler.reconstitute",
        "1:325:1.71",
        this);  
        
      SibTr.exception(tc, e);     
           
      // At the moment, any exception we get while reconstituting means that we
      // want to mark the destination as corrupt.
      _isCorruptOrIndoubt = true;        
           
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "reconstitute", e);
        
      throw new SIResourceException(e);
    }
      
    /*
     * We should have completed all restart message store operations for this
     * link by this point.
     */
     
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "reconstitute");           
  }
766037
@Override
  public void reset () throws IOException
  {
    _ensureOpen ();
    if (m_nMarkedChar < 0)
      throw new IOException (m_nMarkedChar == INVALIDATED ? "Mark invalid" : "Stream not marked");
    m_nNextCharIndex = m_nMarkedChar;
    m_bSkipLF = m_bMarkedSkipLF;
  }
471547
public void save(OutputStream stream) throws IOException
    {
        DataOutputStream out = null;
        try
        {
            out = new DataOutputStream(new BufferedOutputStream(
                    stream));
            for (int i = 0; i < _array.length; ++i)
            {
                out.writeInt(_array[i]);
            }
        }
        finally
        {
            if (out != null)
            {
                out.close();
            }
        }
    }
1017361
@SuppressWarnings("unchecked")
    protected void readFromSerializedStream(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
        cas = stream.readLong();
        expiry = stream.readInt();
        id = stream.readUTF();
        content = (T) stream.readObject();
        mutationToken = (MutationToken) stream.readObject();
    }
756870
public static <T> List<T> toList(Stream<T> stream) {
        return stream.collect(Collectors.<T>toList());
    }
649348
private void refreshInputStream() throws IOException {
    // if stream is null, we probably switched to a new
    // segment.
    if (currentEditLogInputStream == null) {
      LOG.info("Segment - setup input stream for txid: " + currentSegmentTxId);
      setupIngestStreamWithRetries(currentSegmentTxId);
      if (currentEditLogInputStreamPosition == -1) {
        // we are opening a fresh segment
        currentEditLogInputStreamPosition = currentEditLogInputStream.getPosition();
      }
    }

    // if we are re-opening stream previously consumed
    // set correct position
    if (currentEditLogInputStreamPosition != -1) {
      currentEditLogInputStream.refresh(currentEditLogInputStreamPosition,
          mostRecentlyReadTransactionTxId);
    }
  }
29758
@Override
  public void handleStream(final InputStream inputStream) {
    if (executorService.isShutdown()) {
      throw new IllegalStateException("Cannot re-use " + this.getClass().getName());
    }
    result.setFuture(executorService.submit(() -> consumeBytes(inputStream)));
    executorService.shutdown();
  }
374894
public static void streamCopy(InputStream input, Writer output) throws IOException
	{
		if (input == null)
			throw new IllegalArgumentException("Must provide something to read from");
		if (output == null)
			throw new IllegalArgumentException("Must provide something to write to");

		streamCopy(new InputStreamReader(input), output);
	}
239751
private void readObject(java.io.ObjectInputStream stream)
          throws java.io.IOException, javax.xml.transform.TransformerException
  {
    try
    {
      stream.defaultReadObject();
      m_clones =  new IteratorPool(this);
    }
    catch (ClassNotFoundException cnfe)
    {
      throw new javax.xml.transform.TransformerException(cnfe);
    }
  }
817447
public void reconstitutePubSubSourceStreams(StreamSet streamSet, int startMode)
                    throws
                    SIErrorException, SIDiscriminatorSyntaxException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "reconstitutePubSubSourceStreams", new Object[] { streamSet, new Integer(startMode) });

        _sourceStreamManager.reconstituteStreamSet(streamSet);

        // Don't do flush if we are asked to start in recovery mode 
        if (((startMode & JsConstants.ME_START_FLUSH) == JsConstants.ME_START_FLUSH)
            && ((startMode & JsConstants.ME_START_RECOVERY) == 0))
        {
            this.sendFlushedMessage(null, streamSet.getStreamID());
            // Now change streamID of streamSet
            streamSet.setStreamID(new SIBUuid12());
            // This calls requestUpdate on the StreamSet Item which will
            // cause a callback to the streamSet.getPersistentData() by msgstore
            Transaction tran = _txManager.createAutoCommitTransaction();
            try
            {
                streamSet.requestUpdate(tran);
            } catch (MessageStoreException e)
            {
                // MessageStoreException shouldn't occur so FFDC.
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.PubSubInputHandler.reconstitutePubSubSourceStreams",
                                            "1:3145:1.329.1.1",
                                            this);

                SibTr.exception(tc, e);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "reconstitutePubSubSourceStreams", "SIStoreException");
                throw new SIResourceException(e);
            }
        }

        try
        {
            NonLockingCursor cursor = _proxyReferenceStream.newNonLockingCursor(
                            new ClassEqualsFilter(MessageItemReference.class));
            cursor.allowUnavailableItems();
            MessageItemReference ref = (MessageItemReference) cursor.next();

            // Rebuild internalOutputStreams by running refs through matchspace 
            LocalTransaction siTran = null;
            Transaction msTran = null;
            int batchCount = 0;
            while (ref != null)
            {
                // If the count of reconstituted messages has reached 50, commit the transaction
                if (batchCount >= 50) {
                    try
                    {
                        siTran.commit();
                        // Null out the transaction object so that a new one is created next
                        siTran = null;
                    } catch (SIIncorrectCallException e)
                    {
                        // No FFDC code needed
                        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                            SibTr.exit(tc, "reconstitutePubSubSourceStreams", "SIResourceException");
                        throw new SIResourceException(e);
                    }
                }

                // If the transaction object is null then we've either never created it or have just committed it.
                // Create a new transaction 
                if (siTran == null) {
                    siTran = _txManager.createLocalTransaction(true);
                    msTran = (Transaction) siTran;
                    batchCount = 0;
                }

                boolean commitInsert = false;

                // Change streamID in message to streamID of StreamSet
                // If we are restoring from a stale backup this will
                // ensure that the restoreFanOut method puts it on a new InteralOutputStream
                if (ref.getGuaranteedStreamUuid() != streamSet.getStreamID())
                {
                    ref.setGuaranteedStreamUuid(streamSet.getStreamID());
                }

                if (!(ref.isAdding() || ref.isRemoving()))
                    commitInsert = true;
                // If there are no matching neighbours, remove reference
                if (!restoreFanOut(ref, commitInsert))
                {
                    if (!(ref.isAdding() || ref.isRemoving()))
                    {
                        ref.remove(msTran, ref.getLockID());
                        batchCount++;
                    }
                    else
                    // TODO: ref is indoubt, need to mark it for later deletion on commit
                    {
                    }
                }
                ref = (MessageItemReference) cursor.next();
            }
            try
            {
                if (siTran != null) {
                    siTran.commit();
                }
            } catch (SIIncorrectCallException e)
            {
                // No FFDC code needed
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "reconstitutePubSubSourceStreams", "SIResourceException");
                throw new SIResourceException(e);
            }

            // Ditch the cursor & create again to get back to head of list
            cursor.finished();
            cursor = _proxyReferenceStream.newNonLockingCursor(
                            new ClassEqualsFilter(MessageItemReference.class));
            cursor.allowUnavailableItems();
            ref = (MessageItemReference) cursor.next();

            // Add all messages back in to the SourceStreams
            while (ref != null)
            {
                // Change streamID in message to streamID of StreamSet
                // If we are restoring from a stale backup this will
                // and the restoreMessage method puts it on a new SourceStream
                if (ref.getGuaranteedStreamUuid() != streamSet.getStreamID())
                {
                    ref.setGuaranteedStreamUuid(streamSet.getStreamID());
                }

                //add all messages back in to the streams
                if (!(ref.isAdding() || ref.isRemoving()))
                {
                    // commit those which are not in doubt
                    _sourceStreamManager.restoreMessage(ref, true);
                }
                else
                {
                    // add to stream in uncommitted state
                    _sourceStreamManager.restoreMessage(ref, false);
                }

                ref = (MessageItemReference) cursor.next();
            }
            // Consolidate all streams which may have been reconstituted
            _sourceStreamManager.consolidateStreams(startMode);

            cursor.finished();

        } catch (MessageStoreException e)
        {
            // MessageStoreException shouldn't occur so FFDC.
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.PubSubInputHandler.reconstitutePubSubSourceStreams",
                                        "1:3277:1.329.1.1",
                                        this);

            SibTr.exception(tc, e);
            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.PubSubInputHandler",
                                      "1:3284:1.329.1.1",
                                      e });

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "reconstitutePubSubSourceStreams", e);

            throw new SIResourceException(
                            nls.getFormattedMessage(
                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                    new Object[] {
                                                                  "com.ibm.ws.sib.processor.impl.PubSubInputHandler",
                                                                  "1:3295:1.329.1.1",
                                                                  e },
                                                    null),
                            e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "reconstitutePubSubSourceStreams");
    }
1361371
public void resetStream()
        throws IllegalStateException
    {
        if ((_deChunker!=null && _deChunker._chunkSize>0) ||
            _realIn.getByteLimit()>0)
            throw new IllegalStateException("Unread input");
        if(log.isTraceEnabled())log.trace("resetStream()");
        in=_realIn;
        if (_deChunker!=null)
            _deChunker.resetStream();
        _chunking=false;
        _realIn.setByteLimit(-1);
    }
107200
public void setStreams(java.util.Collection<StreamSummary> streams) {
        if (streams == null) {
            this.streams = null;
            return;
        }

        this.streams = new java.util.ArrayList<StreamSummary>(streams);
    }