Code example for InputSupplier

Methods: getInput

0
    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;
Experience pair programming with AI  Get Codota for Java