Class StringUtils


  • public final class StringUtils
    extends java.lang.Object
    File utilities.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private StringUtils()
      Constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void join​(java.lang.StringBuilder buf, java.lang.String addAtBeginning, java.lang.String sep, java.lang.String addAtEnd, java.lang.Iterable<?> iterable)
      A replacement for Java 8's String.join().
      static java.lang.String join​(java.lang.String sep, java.lang.Iterable<?> iterable)
      A replacement for Java 8's String.join().
      static java.lang.String join​(java.lang.String sep, java.lang.Object... items)
      A replacement for Java 8's String.join().
      static java.lang.String readString​(byte[] arr, int startOffset, int numBytes, boolean replaceSlashWithDot, boolean stripLSemicolon)
      Reads the "modified UTF8" format defined in the Java classfile spec, optionally replacing '/' with '.', and optionally removing the prefix "L" and the suffix ";".
      • Methods inherited from class java.lang.Object

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

      • StringUtils

        private StringUtils()
        Constructor.
    • Method Detail

      • readString

        public static java.lang.String readString​(byte[] arr,
                                                  int startOffset,
                                                  int numBytes,
                                                  boolean replaceSlashWithDot,
                                                  boolean stripLSemicolon)
                                           throws java.lang.IllegalArgumentException
        Reads the "modified UTF8" format defined in the Java classfile spec, optionally replacing '/' with '.', and optionally removing the prefix "L" and the suffix ";".
        Parameters:
        arr - the array to read the string from
        startOffset - The start offset of the string within the array.
        numBytes - The number of bytes of the UTF8 encoding of the string.
        replaceSlashWithDot - If true, replace '/' with '.'.
        stripLSemicolon - If true, string final ';' character.
        Returns:
        The string.
        Throws:
        java.lang.IllegalArgumentException - If string could not be parsed.
      • join

        public static void join​(java.lang.StringBuilder buf,
                                java.lang.String addAtBeginning,
                                java.lang.String sep,
                                java.lang.String addAtEnd,
                                java.lang.Iterable<?> iterable)
        A replacement for Java 8's String.join().
        Parameters:
        buf - The buffer to append to.
        addAtBeginning - The token to add at the beginning of the string.
        sep - The separator string.
        addAtEnd - The token to add at the end of the string.
        iterable - The Iterable to join.
      • join

        public static java.lang.String join​(java.lang.String sep,
                                            java.lang.Iterable<?> iterable)
        A replacement for Java 8's String.join().
        Parameters:
        sep - The separator string.
        iterable - The Iterable to join.
        Returns:
        The string representation of the joined elements.
      • join

        public static java.lang.String join​(java.lang.String sep,
                                            java.lang.Object... items)
        A replacement for Java 8's String.join().
        Parameters:
        sep - The separator string.
        items - The items to join.
        Returns:
        The string representation of the joined items.