Guava InputSupplier - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava InputSupplier class.

This code example shows how to use the following methods:getInput
      return chefContext;
   } 
 
   @Override 
   public byte[] encrypt(InputSupplier<? extends InputStream> supplier) throws IOException {
      return ByteStreams2.toByteArrayAndClose(new RSAEncryptingPayload(crypto, Payloads.newPayload(supplier.getInput()), privateKey
                  .get()).openStream());
   } 
 
   @Override 
   public byte[] decrypt(InputSupplier<? extends InputStream> supplier) throws IOException {
      return ByteStreams2.toByteArrayAndClose(new RSADecryptingPayload(crypto, Payloads.newPayload(supplier.getInput()), privateKey
                  .get()).openStream());
   } 
 
   @VisibleForTesting 
   String buildBootstrapConfiguration(BootstrapConfig bootstrapConfig) {
      checkNotNull(bootstrapConfig, "bootstrapConfig must not be null");
 
      Map<String, Object> configMap = Maps.newLinkedHashMap();
5
CodeRank
This code example shows how to use the following methods:getInput
    protected Intent doInBackground(final InputSupplier<InputStream>... params) {
        Preconditions.checkPositionIndex(1, params.length);
        final InputSupplier<CountingInputStream> inputSupplier = new InputSupplier<CountingInputStream>() {
            @Override 
            public CountingInputStream getInput() throws IOException {
                return new CountingInputStream(params[0].getInput());
            } 
        }; 
        try { 
            HashCode hash = ByteStreams.hash(inputSupplier, Hashing.sha256());
            byte[] value = hash.asBytes();
            BigInteger privKey = new BigInteger(hash.toString(), 16);
            ECKey privateKey = new ECKey(privKey);
            Log.d(TAG, "key" + privateKey.toStringWithPrivate());
            Address address = privateKey.toAddress(NETWORK);
            String uri = "bitcoin:" + address + "?amount=" + DEFAULT_AMOUT;
            Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
            i.putExtra(State.HASH_PARAM,address.toString());
            Log.i(TAG, "forwarding to bitcoin uri: " + uri);
            return i;
4
CodeRank
This code example shows how to use the following methods:getInput
   */ 
  @Override 
  @Nullable 
  public Reader get() throws IOException {
    if (input != null) {
      return input.getInput();
    } 
    return null; 
  } 
 
  /** 
   * @return Exit code of command that was executed. 
   */ 
  @Override 
  public int getExitCode() { 
    return exit;
  } 
} 
4
CodeRank
This code example shows how to use the following methods:getInput
      oneHundredOneConstitutions = getTestDataSupplier();
      oneHundredOneConstitutionsMD5 = md5Supplier(oneHundredOneConstitutions);
   } 
 
   protected static byte[] md5Supplier(InputSupplier<InputStream> supplier) throws IOException {
      return asByteSource(supplier.getInput()).hash(md5()).asBytes();
   } 
 
   @SuppressWarnings("unchecked") 
   public static InputSupplier<InputStream> getTestDataSupplier() throws IOException {
      byte[] oneConstitution = ByteStreams.toByteArray(new GZIPInputStream(BaseJettyTest.class
               .getResourceAsStream("/const.txt.gz")));
      InputSupplier<ByteArrayInputStream> constitutionSupplier = ByteStreams.newInputStreamSupplier(oneConstitution);
 
      InputSupplier<InputStream> temp = ByteStreams.join(constitutionSupplier);
 
      for (int i = 0; i < 100; i++) {
         temp = ByteStreams.join(temp, constitutionSupplier);
      } 
      oneHundredOneConstitutionsLength = oneConstitution.length * 101l;
3
CodeRank
See Code Examples for Guava InputSupplier Methods: