Package org.bitcoinj.base.internal
Class InternalUtils
java.lang.Object
org.bitcoinj.base.internal.InternalUtils
Utilities for internal use only.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA functional interface for joiningStrings orObjects viaObject.toString()using a pre-configured delimiter.static interfaceA functional interface for splittingStrings using a pre-configured regular expression. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final InternalUtils.JoinerAInternalUtils.Joinerfor joining strings into a single string delimited by a space character.static final InternalUtils.SplitterAInternalUtils.Splitterfor splitting a string into components by whitespace. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringJoin strings with ", " skipping nullsstatic <V> VgetUninterruptibly(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.Joinerstatic InternalUtils.SplitterReturn a lambda for splitting a string into components
-
Field Details
-
SPACE_JOINER
AInternalUtils.Joinerfor joining strings into a single string delimited by a space character. -
WHITESPACE_SPLITTER
AInternalUtils.Splitterfor splitting a string into components by whitespace.
-
-
Constructor Details
-
InternalUtils
public InternalUtils()
-
-
Method Details
-
joiner
- Parameters:
delimiter- The delimiter used to join theStringcomponents- Returns:
- A
Joiner(lambda) instance
-
splitter
Return a lambda for splitting a string into components- Parameters:
regex- regular expression used to split components- Returns:
- A
Splitter(lambda) instance
-
commaJoin
Join strings with ", " skipping nulls- Parameters:
strings- varargs strings- Returns:
- A joined string
-
getUninterruptibly
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:
ExecutionException- if the computation through an exception
-