Gets the SIdChain for the given stream Id

@param pSId        the stream Id
@param pStreamSize the size of the stream, or -1 for system control streams
@return the SIdChain for the given stream Id
@throws IOException if an I/O exception occurs
493275
private SIdChain getSIdChain(final int pSId, final long pStreamSize) throws IOException {
        SIdChain chain = new SIdChain();

        int[] sat = isShortStream(pStreamSize) ? shortSAT : SAT;

        int sid = pSId;
        while (sid != END_OF_CHAIN_SID && sid != FREE_SID) {
            chain.addSID(sid);
            sid = sat[sid];
        }

        return chain;
    }
40516
public void encodeAndApply(InputStream inputStream, String ssid, String msgId, Consumer<StreamFragmentBean> consumer) {
        try (final InputStream _inputStream = inputStream) {
            final int LENGTH = StreamManager.BUF_SIZE_IN_BYTE;
            int read;
            boolean first = true;
            boolean last;
            int current = -1;
            do {
                byte[] buffer = new byte[LENGTH];
                read = _inputStream.read(buffer);
                if (read == -1) {
                    last = true;
                    buffer = new byte[0];
                } else if (read < LENGTH) {
                    buffer = Arrays.copyOf(buffer, read);
                    last = true;
                } else
                    last = false;
                StreamFragmentBean.Header header = new StreamFragmentBean.Header();
                header.setFirst(first);
                header.setId(ssid);
                header.setLast(last);
                header.setMsgId(msgId);
                header.setIndex(++current);
                StreamFragmentBean streamFragmentBean = new StreamFragmentBean();
                streamFragmentBean.setBody(buffer);
                streamFragmentBean.setHeader(header);
                streamFragmentBean.setMessageType(MessageType.responseStream);
                consumer.accept(streamFragmentBean);
                first = false;
            }
            while (!last);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
292268
public static StreamBootstrapper getInstance(String pubId, SystemId sysId, byte[] data, int start, int end)
    {
        return new StreamBootstrapper(pubId, sysId, data, start, end);
    }
130354
public SIBUuid12 getStreamID()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getStreamID");  
    SIBUuid12 returnValue = aiStream.getStreamId();   
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getStreamID", returnValue);
    return returnValue;
  }
1258084
private static @Nullable Pair<Integer, Integer> getVP8Dimension(final InputStream is)
      throws IOException {
    // We need to skip 7 bytes
    is.skip(7);
    // And then check the signature
    final short sign1 = getShort(is);
    final short sign2 = getShort(is);
    final short sign3 = getShort(is);
    if (sign1 != 0x9D || sign2 != 0x01 || sign3 != 0x2A) {
      // Signature error
      return null;
    }
    // We read the dimensions
    return new Pair<>(get2BytesAsInt(is), get2BytesAsInt(is));
  }
142365
public static String pidMemoryUsage(int pid) throws IOException {
    Process process =
        new ProcessBuilder().command("ps", "-o", "pid,rss,vsz", "-p", Long.toString(pid)).start();

    BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));

    reader.readLine(); // Skip header

    String line = reader.readLine();
    String[] parts = line.trim().split("\\s+", 3);

    int readPid = Integer.parseInt(parts[0]);
    if (pid != readPid) {
      throw new RuntimeException("`ps` returned something unexpected: '" + line + "'");
    }

    long rss = Long.parseLong(parts[1]) * 1024;
    long vsz = Long.parseLong(parts[2]);

    // 0 pid, 1 rss, 2 vsz
    return String.format("%d\t%d", rss, vsz);
  }
1224164
public static SymbolToken systemSymbol(final int sid) {
        if (sid < 1 || sid > ION_1_0_MAX_ID)
        {
            throw new IllegalArgumentException("No such system SID: " + sid);
        }
        return SYSTEM_TOKENS.get(sid - 1);
    }
13333
@Override
    public InputStream getAttachment(final Asset asset, final Attachment attachment) throws IOException, BadVersionException, RequestFailureException {
        final ZipFile repoZip = createZipFile();

        if (null == repoZip) {
            return null;
        }

        InputStream retInputStream = null;
        String attachmentId = attachment.get_id();

        try {
            if (attachmentId.contains("#")) {
                String assetId = asset.get_id();
                // new funky code to get an input stream to the license *inside* the main attachment. The start of
                // the assetId will point to the main attachment file.
                ZipEntry entry = createFromRelative(assetId);

                // If the entry wasn't found return null
                if (null == entry) {
                    return null;
                }

                // Get zip input stream to the asset inside the zip
                ZipInputStream zis = new ZipInputStream(repoZip.getInputStream(entry));

                // Get the input stream to the attachment inside the zip
                retInputStream = getInputStreamToLicenseInsideZip(zis, assetId, attachmentId);

            } else {
                // Get input stream to the attachment
                ZipEntry entry = createFromRelative(attachmentId);
                retInputStream = repoZip.getInputStream(entry);
            }
        } finally {
            // If we are throwing an exception the InputStream is never created so the logic below
            // to close the ZipFile when the InputStream is closed will never be called. So lets close
            // the ZipFile now as there is no InputStream to read from.
            if (retInputStream == null) {
                repoZip.close();
            }
        }

        // When the input stream gets closed we also need to close the ZipFile, however
        // the caller only has the input stream. So lets wrap the input stream and close
        // both the inputStream and the ZipFile when the caller calls close on the wrapped
        // input stream
        final InputStream is = retInputStream;
        InputStream wrappedIs = new InputStream() {

            /** {@inheritDoc} */
            @Override
            public int read(byte[] b) throws IOException {
                return is.read(b);
            }

            /** {@inheritDoc} */
            @Override
            public int read(byte[] b, int off, int len) throws IOException {
                return is.read(b, off, len);
            }

            /** {@inheritDoc} */
            @Override
            public long skip(long n) throws IOException {
                return is.skip(n);
            }

            /** {@inheritDoc} */
            @Override
            public int available() throws IOException {
                return is.available();
            }

            /** {@inheritDoc} */
            @Override
            public synchronized void mark(int readlimit) {
                is.mark(readlimit);
            }

            /** {@inheritDoc} */
            @Override
            public synchronized void reset() throws IOException {
                is.reset();
            }

            /** {@inheritDoc} */
            @Override
            public boolean markSupported() {
                return is.markSupported();
            }

            /** {@inheritDoc} */
            @Override
            public int read() throws IOException {
                return is.read();
            }

            /** {@inheritDoc} */
            @Override
            public void close() throws IOException {
                // When the input stream is closed, also close the zip file
                is.close();
                repoZip.close();
            }
        };
        return wrappedIs;
    }
1264505
public static ByteBuffer getByteBufferFromInputStreamAndCloseStream(InputStream is) throws IOException {
        try {
            // is.available() may return 0, or 1, or the total number of bytes in the stream,
            // or some other number.
            // Do not try to use is.available() == 0 to find the end of the stream!
            byte[] bytes;
            int avail = is.available();
            if (avail > 32) {
                // There are more bytes available than just the ICU data header length.
                // With luck, it is the total number of bytes.
                bytes = new byte[avail];
            } else {
                bytes = new byte[128];  // empty .res files are even smaller
            }
            // Call is.read(...) until one returns a negative value.
            int length = 0;
            for(;;) {
                if (length < bytes.length) {
                    int numRead = is.read(bytes, length, bytes.length - length);
                    if (numRead < 0) {
                        break;  // end of stream
                    }
                    length += numRead;
                } else {
                    // See if we are at the end of the stream before we grow the array.
                    int nextByte = is.read();
                    if (nextByte < 0) {
                        break;
                    }
                    int capacity = 2 * bytes.length;
                    if (capacity < 128) {
                        capacity = 128;
                    } else if (capacity < 0x4000) {
                        capacity *= 2;  // Grow faster until we reach 16kB.
                    }
                    // TODO Java 6 replace new byte[] and arraycopy(): bytes = Arrays.copyOf(bytes, capacity);
                    byte[] newBytes = new byte[capacity];
                    System.arraycopy(bytes, 0, newBytes, 0, length);
                    bytes = newBytes;
                    bytes[length++] = (byte) nextByte;
                }
            }
            return ByteBuffer.wrap(bytes, 0, length);
        } finally {
            is.close();
        }
    }
871776
public static IntStream buildRandomIntStream(int streamSize,
            IntSupplier randomIntSupplier) {
        return JMStream.increaseRange(streamSize)
                .map(i -> randomIntSupplier.getAsInt());
    }
792978
@Override
    public X509Certificate[] getCertificateChain(String s) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "getCertificateChain: " + s);

        X509Certificate[] rc = getX509KeyManager().getCertificateChain(s);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "getCertificateChain", rc);
        return rc;
    }
649419
public String getStreamHeader() {
    StringBuilder builder = new StringBuilder();
    builder.append("GDAT").append(Constants.NEWLINE).append("VERSION:").append(VERSION).append(Constants.NEWLINE)
      .append("SCHEMALENGTH:");
    String streamTree = getStreamParseTree();
    int headerLength = streamTree.length();
    builder.append(Integer.toString(headerLength));
    builder.append(Constants.NEWLINE);
    builder.append(streamTree);
    return builder.toString();
  }
708177
public final SIBUuid12 getGuaranteedStreamUUID() {
        byte[] b = (byte[]) getHdr2().getField(JsHdr2Access.GUARANTEED_SET_STREAMUUID);
        if (b != null)
            return new SIBUuid12(b);
        return null;
    }
35161
public AuthorityKeyIdentifierExtension getAuthKeyIdExtension()
        throws IOException {
        Object obj = getExtension(PKIXExtensions.AuthorityKey_Id);
        return (AuthorityKeyIdentifierExtension)obj;
    }
860221
public String getId()
  {
    try
    {
      if(id == null) 
        id = ""+itemStream.getID();
    }
    catch(MessageStoreException e)
    {
      // FFDC
      FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.runtime.XmitPointControl.getId",
          "1:136:1.17", 
          this);
      
      SibTr.exception(tc, e);
    }
    return id;
  }
974509
@Override
	public Certificate[] engineGetCertificateChain(String s) {
		CredentialWrapper credential = getKeyEntry(s);
		X509Certificate[] chain = new X509Certificate[0];
		if (credential != null) {
			try {
				chain = credential.getCredential().getCertificateChain();
			} catch (ResourceStoreException e) {
				logger.warn(e.getMessage(), e);
				chain = null;
			}
		}
		return chain;
	}
690733
public static Integer getS3StreamBufferSize() {
        String s =
            System.getProperty(SDKGlobalConfiguration.DEFAULT_S3_STREAM_BUFFER_SIZE);
        if (s == null)
            return null;
        try {
            return Integer.valueOf(s);
        } catch (Exception e) {
            log.warn("Unable to parse buffer size override from value: " + s);
        }
        return null;
    }