Package org.bitcoinj.base.internal
Class InternalUtils
- java.lang.Object
-
- org.bitcoinj.base.internal.InternalUtils
-
public class InternalUtils extends java.lang.Object
Utilities for internal use only.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
InternalUtils.Joiner
A functional interface for joiningString
s orObject
s viaObject.toString()
using a pre-configured delimiter.static interface
InternalUtils.Splitter
A functional interface for splittingString
s using a pre-configured regular expression.
-
Field Summary
Fields Modifier and Type Field Description static InternalUtils.Joiner
SPACE_JOINER
AInternalUtils.Joiner
for joining strings into a single string delimited by a space character.static InternalUtils.Splitter
WHITESPACE_SPLITTER
AInternalUtils.Splitter
for splitting a string into components by whitespace.
-
Constructor Summary
Constructors Constructor Description InternalUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
commaJoin(java.lang.String... strings)
Join strings with ", " skipping nullsstatic <V> V
getUninterruptibly(java.util.concurrent.Future<V> future)
Get a future's valueuninterruptibly
by temporarily ignoringInterruptedException
, but making sure we re-set the thread's interrupt status, so higher-level code on the thread can handle the interruption properly.static InternalUtils.Joiner
joiner(java.lang.String delimiter)
Return a lambda for joiningString
s orObject
s viaObject.toString()
.static InternalUtils.Splitter
splitter(java.lang.String regex)
Return a lambda for splitting a string into components
-
-
-
Field Detail
-
SPACE_JOINER
public static final InternalUtils.Joiner SPACE_JOINER
AInternalUtils.Joiner
for joining strings into a single string delimited by a space character.
-
WHITESPACE_SPLITTER
public static final InternalUtils.Splitter WHITESPACE_SPLITTER
AInternalUtils.Splitter
for splitting a string into components by whitespace.
-
-
Method Detail
-
joiner
public static InternalUtils.Joiner joiner(java.lang.String delimiter)
Return a lambda for joiningString
s orObject
s viaObject.toString()
.- Parameters:
delimiter
- The delimiter used to join theString
components- Returns:
- A
Joiner
(lambda) instance
-
splitter
public static InternalUtils.Splitter splitter(java.lang.String regex)
Return a lambda for splitting a string into components- Parameters:
regex
- regular expression used to split components- Returns:
- A
Splitter
(lambda) instance
-
commaJoin
public static java.lang.String commaJoin(java.lang.String... strings)
Join strings with ", " skipping nulls- Parameters:
strings
- varargs strings- Returns:
- A joined string
-
getUninterruptibly
public static <V> V getUninterruptibly(java.util.concurrent.Future<V> future) throws java.util.concurrent.ExecutionException
Get a future's valueuninterruptibly
by temporarily ignoringInterruptedException
, but making sure we re-set the thread's interrupt status, so higher-level code on the thread can handle the interruption properly. Based upon the Guava implementation.- Type Parameters:
V
- type of value- Parameters:
future
- future with value to get- Returns:
- the value
- Throws:
java.util.concurrent.ExecutionException
- if the computation through an exception
-
-