mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
Utils: Remove closeUnchecked() helpers, use Guava instead.
This commit is contained in:
parent
2b765d8aa8
commit
b6ecc380b8
@ -29,7 +29,6 @@ import org.spongycastle.crypto.digests.RIPEMD160Digest;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
@ -625,23 +624,4 @@ public class Utils {
|
|||||||
List<String> lines = Resources.readLines(url, Charsets.UTF_8);
|
List<String> lines = Resources.readLines(url, Charsets.UTF_8);
|
||||||
return Joiner.on('\n').join(lines);
|
return Joiner.on('\n').join(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't use Closeable here because it's Java 7 only and Android devices only got that with KitKat.
|
|
||||||
public static InputStream closeUnchecked(InputStream stream) {
|
|
||||||
try {
|
|
||||||
stream.close();
|
|
||||||
return stream;
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static OutputStream closeUnchecked(OutputStream stream) {
|
|
||||||
try {
|
|
||||||
stream.close();
|
|
||||||
return stream;
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.bitcoinj.kits;
|
package org.bitcoinj.kits;
|
||||||
|
|
||||||
import com.google.common.collect.*;
|
import com.google.common.collect.*;
|
||||||
|
import com.google.common.io.Closeables;
|
||||||
import com.google.common.util.concurrent.*;
|
import com.google.common.util.concurrent.*;
|
||||||
import org.bitcoinj.core.listeners.*;
|
import org.bitcoinj.core.listeners.*;
|
||||||
import org.bitcoinj.core.*;
|
import org.bitcoinj.core.*;
|
||||||
@ -149,7 +150,7 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
*/
|
*/
|
||||||
public WalletAppKit setCheckpoints(InputStream checkpoints) {
|
public WalletAppKit setCheckpoints(InputStream checkpoints) {
|
||||||
if (this.checkpoints != null)
|
if (this.checkpoints != null)
|
||||||
Utils.closeUnchecked(this.checkpoints);
|
Closeables.closeQuietly(checkpoints);
|
||||||
this.checkpoints = checkNotNull(checkpoints);
|
this.checkpoints = checkNotNull(checkpoints);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user