Construct a LifecycleChaincodePackage from a stream.

@param inputStream The stream containing the lifecycle chaincode package. This stream is NOT closed.
@throws IOException
767169
public static LifecycleChaincodePackage fromStream(InputStream inputStream) throws IOException, InvalidArgumentException {
        if (null == inputStream) {
            throw new InvalidArgumentException("The parameter inputStream may not be null.");
        }
        byte[] packageBytes = IOUtils.toByteArray(inputStream);
        return fromBytes(packageBytes);
    }
407673
private static InputStream inputStreamFromFile(String relativePathPrefix, String src) throws IOException {
        File file = getFile(relativePathPrefix, src);
        if (!file.exists()) {
            if (src.length() > 0 && src.charAt(0) == File.separatorChar) {
                file = getFile(relativePathPrefix, src.substring(1));
            }
            if (!file.exists()) {
                file = null;
            }
        } else if (!file.isFile() || !file.canRead()) {
            file = null;
        }
        if (file != null) {
            return new FileInputStream(file);
        }
        return null;
    }
629383
public final void parse(InputStream stream) throws IOException {

        // all XML exceptions are wrapped by IOExceptions
        try {

            // setup a namespace aware SAXParserFactory
            SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
            saxParserFactory.setNamespaceAware(true);

            // parse the input stream
            SAXParser parser = saxParserFactory.newSAXParser();
            parser.parse(stream, this);

        } catch (ParserConfigurationException e) {
            throw new IOException(e);
        } catch (SAXException e) {
            throw new IOException(e);
        }

    }
613812
@Override
    public synchronized ChainData createOutboundChain() throws ChannelFrameworkException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "createOutboundChain");
        }

        // Check to see if the chain has already been created.
        if (outboundChainData == null) {
            this.outboundChainData = framework.createOutboundChain(this);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "createOutboundChain");
        }
        return this.outboundChainData;
    }
642612
public static InputStreamResource inputStreamResource(final String path,
                                                          final SupplierWithThrowable<InputStream, IOException> supplier) {
        return new InputStreamResource(path, supplier);
    }
476682
public void parseStream (InputStream stream)
        throws IOException
    {
        try {
            // read the XML input stream and construct the scene object
            _chars = new StringBuilder();
            XMLUtil.parse(this, stream);

        } catch (ParserConfigurationException pce) {
            throw (IOException) new IOException().initCause(pce);

        } catch (SAXException saxe) {
            throw (IOException) new IOException().initCause(saxe);
        }
    }
733160
@Override
    public InputStream exportAsInputStream() {
        // Create export delegate
        final AbstractExporterDelegate<InputStream> exportDelegate = new TarExporterDelegate(this.getArchive());

        // Execute export
        return exportDelegate.export();
    }
356526
public void init(final InputStream inputStream) {
		try (final InputStream is = inputStream) {
			final Manifest mf = new Manifest(is);
			final Attributes attr = mf.getMainAttributes();
			commit = attr.getValue("git-commit");
			gitUrl = attr.getValue("git-url");
			version = attr.getValue("project-version");
			final long time = Long.parseLong(attr.getValue("creation-date"));
			creationDate = DateFormat.getDateTimeInstance(DATEFORMAT, DATEFORMAT).format(new Date(time));
		} catch (Exception e) {
			initBackToDefaults();
		}
	}
66560
public void setInputStream(InputStream stream) {
        try {
            cachedInputStream = new ByteArrayOutputStream();
            IOUtils.copy(stream, cachedInputStream);
        } catch (IOException e) {
            LOG.error("Exception on writing InputStream.", e);
        }
    }
496707
public <U> BaseSimpleReactStream<U> fromStream(final Stream<CompletableFuture<U>> stream) {

        final Stream s = stream;
        return construct(s);
    }
274692
public static ParameterTool fromPropertiesFile(InputStream inputStream) throws IOException {
		Properties props = new Properties();
		props.load(inputStream);
		return fromMap((Map) props);
	}
989647
public static Dependencies load(final InputStream inputStream) {
        Utils4J.checkNotNull("inputStream", inputStream);
        final XStream xstream = createXStream();
        final Reader reader = new InputStreamReader(inputStream);
        return (Dependencies) xstream.fromXML(reader);
    }
217589
public void release(InputStream inputStream) throws IOException {
    // for non-seekable input stream, close and return
    if (!(inputStream instanceof CachedSeekableInputStream) || !CACHE_ENABLED) {
      inputStream.close();
      return;
    }

    synchronized (mFileIdToInputStreamIds) {
      if (!mFileIdToInputStreamIds
          .containsKey(((CachedSeekableInputStream) inputStream).getFileId())) {
        LOG.debug("The resource {} is already expired",
            ((CachedSeekableInputStream) inputStream).getResourceId());
        // the cache no longer tracks this input stream
        inputStream.close();
        return;
      }
      UfsInputStreamIdSet resources =
          mFileIdToInputStreamIds.get(((CachedSeekableInputStream) inputStream).getFileId());
      if (!resources.release(((CachedSeekableInputStream) inputStream).getResourceId())) {
        LOG.debug("Close the expired input stream resource of {}",
            ((CachedSeekableInputStream) inputStream).getResourceId());
        // the input stream expired, close it
        inputStream.close();
      }
    }
  }
962902
public void createDirectoryEntries(JarOutputStream jarStream, String packageName) throws IOException {
        StringBuilder entryName = new StringBuilder(packageName.length());
        for (String str : packageName.split("\\.")) {
            entryName.append(str).append("/");
            JarEntry jarEntry = new JarEntry(entryName.toString());
            jarStream.putNextEntry(jarEntry);
        }
    }
910333
public void read(@WillClose InputStream in) throws IOException {
        BufferedInputStream prefStream = null;
        Properties props = new Properties();
        try {
            prefStream = new BufferedInputStream(in);
            props.load(prefStream);
        } finally {
            try {
                if (prefStream != null) {
                    prefStream.close();
                }
            } catch (IOException ioe) {
                // Ignore
            }
        }

        if (props.size() == 0) {
            return;
        }

        Properties prefixlessProperties = new Properties();
        for (Map.Entry<?, ?> e : props.entrySet()) {
            if(e.getKey() instanceof String) {
                String key = e.getKey().toString();
                String value = e.getValue().toString();
                prefixlessProperties.setProperty(key.replace("/instance/edu.umd.cs.findbugs.plugin.eclipse/", "")
                                                    .replace("/instance/com.github.spotbugs.plugin.eclipse/", ""), value);
            } else {
                prefixlessProperties.put(e.getKey(), e.getValue());
            }
        }
        props = prefixlessProperties;

        for (int i = 0; i < MAX_RECENT_FILES; i++) {
            String key = "recent" + i;
            String projectName = (String) props.get(key);
            if (projectName != null) {
                recentProjectsList.add(projectName);
            }
        }


        for (Map.Entry<?, ?> e : props.entrySet()) {

            String key = (String) e.getKey();
            if (!key.startsWith("detector") || key.startsWith("detector_")) {
                // it is not a detector enablement property
                continue;
            }
            String detectorState = (String) e.getValue();
            int pipePos = detectorState.indexOf(BOOL_SEPARATOR);
            if (pipePos >= 0) {
                String name = detectorState.substring(0, pipePos);
                String enabled = detectorState.substring(pipePos + 1);
                detectorEnablementMap.put(name, Boolean.valueOf(enabled));
            }
        }

        if (props.get(FILTER_SETTINGS_KEY) != null) {
            // Properties contain encoded project filter settings.
            filterSettings = ProjectFilterSettings.fromEncodedString(props.getProperty(FILTER_SETTINGS_KEY));
        } else {
            // Properties contain only minimum warning priority threshold
            // (probably).
            // We will honor this threshold, and enable all bug categories.
            String threshold = (String) props.get(DETECTOR_THRESHOLD_KEY);
            if (threshold != null) {
                try {
                    int detectorThreshold = Integer.parseInt(threshold);
                    setUserDetectorThreshold(detectorThreshold);
                } catch (NumberFormatException nfe) {
                    // Ok to ignore
                }
            }
        }
        if (props.get(FILTER_SETTINGS2_KEY) != null) {
            // populate the hidden bug categories in the project filter settings
            ProjectFilterSettings.hiddenFromEncodedString(filterSettings, props.getProperty(FILTER_SETTINGS2_KEY));
        }
        if (props.get(RUN_AT_FULL_BUILD) != null) {
            runAtFullBuild = Boolean.parseBoolean(props.getProperty(RUN_AT_FULL_BUILD));
        }
        effort = props.getProperty(EFFORT_KEY, EFFORT_DEFAULT);
        includeFilterFiles = readProperties(props, KEY_INCLUDE_FILTER);
        excludeFilterFiles = readProperties(props, KEY_EXCLUDE_FILTER);
        excludeBugsFiles = readProperties(props, KEY_EXCLUDE_BUGS);
        customPlugins = readProperties(props, KEY_PLUGIN);
    }
627143
public void initFromBackup(InputStream is) throws IOException {
    int count = 0;
    try (GzipCompressorInputStream gzIn = new GzipCompressorInputStream(is);
         JournalEntryStreamReader reader = new JournalEntryStreamReader(gzIn)) {
      List<Master> masters = mRegistry.getServers();
      JournalEntry entry;
      Map<String, Master> mastersByName = Maps.uniqueIndex(masters, Master::getName);
      while ((entry = reader.readEntry()) != null) {
        String masterName = JournalEntryAssociation.getMasterForEntry(entry);
        Master master = mastersByName.get(masterName);
        try {
          master.processJournalEntry(entry);
        } catch (Throwable t) {
          JournalUtils.handleJournalReplayFailure(
              LOG, t, "Failed to process journal entry %s when init from backup", entry);
        }
        try (JournalContext jc = master.createJournalContext()) {
          jc.append(entry);
          count++;
        }
      }
    }
    LOG.info("Restored {} entries from backup", count);
  }
1277263
public void init(InputStream in) throws IOException 
    {
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"init", "init"); 
        } 
        this.in = in;
        next();
        obs=null;
    }