Class Utils


  • public class Utils
    extends java.lang.Object
    A collection of various utility methods that are helpful for working with the Bitcoin protocol. To enable debug logging from the library, run with -Dbitcoinj.logging=true on your command line.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_INITIAL_ARRAY_LENGTH
      Max initial size of variable length arrays and ArrayLists that could be attacked.
      static com.google.common.base.Joiner SPACE_JOINER
      Deprecated.
      Use @link java.util.StringJoiner} or a direct Guava dependency
      static com.google.common.base.Splitter WHITESPACE_SPLITTER
      Deprecated.
      Use String.split(String) or a direct Guava dependency
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String toString​(java.util.List<byte[]> stack)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SPACE_JOINER

        @Deprecated
        public static final com.google.common.base.Joiner SPACE_JOINER
        Deprecated.
        Use @link java.util.StringJoiner} or a direct Guava dependency
        Joiner for concatenating words with a space inbetween.
      • WHITESPACE_SPLITTER

        @Deprecated
        public static final com.google.common.base.Splitter WHITESPACE_SPLITTER
        Deprecated.
        Use String.split(String) or a direct Guava dependency
        Splitter for splitting words on whitespaces.
      • MAX_INITIAL_ARRAY_LENGTH

        public static final int MAX_INITIAL_ARRAY_LENGTH
        Max initial size of variable length arrays and ArrayLists that could be attacked. Avoids this attack: Attacker sends a msg indicating it will contain a huge number (eg 2 billion) elements (eg transaction inputs) and forces bitcoinj to try to allocate a huge piece of the memory resulting in OutOfMemoryError.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • toString

        public static java.lang.String toString​(java.util.List<byte[]> stack)