Get data back out of the cache as a ByteStream.

@param string                $nsKey
@param string                $itemKey
@param Swift_InputByteStream $is      to write the data to
177882
public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is)
    {
        if ($this->hasKey($nsKey, $itemKey)) {
            $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
            while (!feof($fp) && false !== $bytes = fread($fp, 8192)) {
                $is->write($bytes);
            }
            $this->freeHandle($nsKey, $itemKey);
        }
    }
477676
private function load(iterable $data, $item, $key, bool $flush, int &$flushCounter, int &$totalCounter): void
    {
        try {
            ($this->load)($data, $key, $this);
            $this->eventDispatcher->dispatch(new ItemEvent(EtlEvents::LOAD, $item, $key, $this));
        } catch (\Throwable $e) {
            /** @var ItemExceptionEvent $event */
            $event = $this->eventDispatcher->dispatch(new ItemExceptionEvent(EtlEvents::LOAD_EXCEPTION, $item, $key, $this, $e));
            if ($event->shouldThrowException()) {
                throw $e;
            }
            $flushCounter--;
            $totalCounter--;
        }

        if (true === $flush) {
            $this->flush($flushCounter, true);
        }
    }
1115642
public function unbind(Swift_InputByteStream $is)
    {
        // Don't have to mirror anything
        foreach ($this->bound as $k => $stream) {
            if ($stream === $is) {
                unset($this->bound[$k]);

                break;
            }
        }

        return $this;
    }
69668
private void writeToDiskCache(
      final CacheKey key,
      final EncodedImage encodedImage) {
    FLog.v(TAG, "About to write to disk-cache for key %s", key.getUriString());
    try {
      mFileCache.insert(
          key, new WriterCallback() {
            @Override
            public void write(OutputStream os) throws IOException {
              mPooledByteStreams.copy(encodedImage.getInputStream(), os);
            }
          }
      );
      FLog.v(TAG, "Successful disk-cache write for key %s", key.getUriString());
    } catch (IOException ioe) {
      // Log failure
      // TODO: 3697790
      FLog.w(TAG, ioe, "Failed to write to disk-cache for key %s", key.getUriString());
    }
  }
603038
private String getRow(String rowKey) {
        try {
            return cache.get(rowKey);
        } catch (Exception e) {
            if (e.getCause() instanceof RowNotFoundException) {
                return null;
            }
            throw new RuntimeException(e);
        }
    }
71817
public static void write(final PublicKey publicKey, final @NonNull OutputStream outputStream)
		throws IOException
	{
		final byte[] publicKeyBytes = publicKey.getEncoded();
		final X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyBytes);
		outputStream.write(keySpec.getEncoded());
		outputStream.close();
	}
566890
public function setString($nsKey, $itemKey, $string, $mode)
    {
        $this->prepareCache($nsKey);
        switch ($mode) {
            case self::MODE_WRITE:
                $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
                break;
            case self::MODE_APPEND:
                $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
                break;
            default:
                throw new Swift_SwiftException(
                    'Invalid mode ['.$mode.'] used to set nsKey='.
                    $nsKey.', itemKey='.$itemKey
                    );
                break;
        }
        fwrite($fp, $string);
        $this->freeHandle($nsKey, $itemKey);
    }
636099
public function setString($nsKey, $itemKey, $string, $mode)
    {
        $this->prepareCache($nsKey);
        switch ($mode) {
            case self::MODE_WRITE:
                $this->contents[$nsKey][$itemKey] = $string;
                break;
            case self::MODE_APPEND:
                if (!$this->hasKey($nsKey, $itemKey)) {
                    $this->contents[$nsKey][$itemKey] = '';
                }
                $this->contents[$nsKey][$itemKey] .= $string;
                break;
            default:
                throw new Swift_SwiftException(
                    'Invalid mode ['.$mode.'] used to set nsKey='.
                    $nsKey.', itemKey='.$itemKey
                    );
        }
    }
1303204
private final StreamInfo getStreamInfo(String streamKey, SIBUuid12 streamId)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getStreamInfo", new Object[]{streamKey, streamId});
    StreamInfo sinfo = streamTable.get(streamKey);
    if ((sinfo != null) && sinfo.streamId.equals(streamId))
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", sinfo);
      return sinfo;
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", null);
    return null;
  }
396467
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
    {
        while (false !== ($bytes = $os->read(8192))) {
            $is->write($bytes);
        }
    }
1181887
public function hasCell($columnKey, $rowKey) : bool
    {
        $this->validateColumnKey(__METHOD__, $columnKey);
        $this->validateRowKey(__METHOD__, $rowKey);

        $this->loadColumns();
        $this->loadRows();

        $columnHash = ValueHasher::hash($columnKey);
        if (!isset($this->columns[$columnHash])) {
            return false;
        }

        $rowHash = ValueHasher::hash($rowKey);
        if (!isset($this->rows[$rowHash])) {
            return false;
        }

        return true;
    }
843851
public static function DecryptByteStream ($byte, $key, $options = []) {
		$options['module'] = \MCRYPT_MODE_CFB;
		return static::Decrypt($byte, $key, $options);
	}
1021514
public static function EncryptByteStream ($byte, $key, $options = []) {
		$options['module'] = \MCRYPT_MODE_CFB;
		return static::Encrypt($byte, $key, $options);
	}
466515
private function saveDeferred($key, $data, $expiresAfter = null, $tags = [])
    {
        $item = $this->cache->getItem($key);
        $item->set($data);
        $item->expiresAfter($expiresAfter);

        if (0 !== \count($tags)) {
            $item->tag($tags);
        }

        return $this->cache->saveDeferred($item);
    }
196876
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
    {
        $leftOver = '';
        while (false !== $bytes = $os->read(8192)) {
            $toencode = $leftOver.$bytes;
            if ($this->canonical) {
                $toencode = $this->canonicalize($toencode);
            }
            $wrapped = $this->safeWordwrap($toencode, $maxLineLength, "\r\n");
            $lastLinePos = strrpos($wrapped, "\r\n");
            $leftOver = substr($wrapped, $lastLinePos);
            $wrapped = substr($wrapped, 0, $lastLinePos);

            $is->write($wrapped);
        }
        if (strlen($leftOver)) {
            $is->write($leftOver);
        }
    }
281349
public function read($key, $namespace)
    {
        // Get internal used key
        $key = $this->calculateUuid($key);

        // Try to retrieve data from runtime cache ...
        $dataset = $this->getFromRuntimeCache($key, $namespace);

        // Check for result from runtime cache
        if ($dataset === false) {

            // get filename
            $filename = $this->getFilenameByKeyAndNamespace($key, $namespace);

            // if file does not exist -> then there is nothing to read
            if (!file_exists($filename)) {
                return false;
            }

            // Read (no lock = change possible from another process!)
            $dataset = $this->readFile($filename, false);
        }

        return $dataset;
    }
953324
public static LottieTask<LottieComposition> fromJsonInputStream(final InputStream stream, @Nullable final String cacheKey) {
    return cache(cacheKey, new Callable<LottieResult<LottieComposition>>() {
      @Override public LottieResult<LottieComposition> call() {
        return fromJsonInputStreamSync(stream, cacheKey);
      }
    });
  }