Class StringUtils

java.lang.Object
nonapi.io.github.classgraph.utils.StringUtils

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

    Constructors
    Modifier
    Constructor
    Description
    private
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    join(StringBuilder buf, String addAtBeginning, String sep, String addAtEnd, Iterable<?> iterable)
    A replacement for Java 8's String.join().
    static String
    join(String sep, Iterable<?> iterable)
    A replacement for Java 8's String.join().
    static String
    join(String sep, Object... items)
    A replacement for Java 8's String.join().
    static 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 Details

    • StringUtils

      private StringUtils()
      Constructor.
  • Method Details

    • readString

      public static String readString(byte[] arr, int startOffset, int numBytes, boolean replaceSlashWithDot, boolean stripLSemicolon) throws 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:
      IllegalArgumentException - If string could not be parsed.
    • join

      public static void join(StringBuilder buf, String addAtBeginning, String sep, String addAtEnd, 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 String join(String sep, 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 String join(String sep, 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.