Class StringUtils
java.lang.Object
nonapi.io.github.classgraph.utils.StringUtils
File utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
A replacement for Java 8's String.join().static String
A replacement for Java 8's String.join().static String
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 ";".
-
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 fromstartOffset
- 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
- TheIterable
to join.
-
join
A replacement for Java 8's String.join().- Parameters:
sep
- The separator string.iterable
- TheIterable
to join.- Returns:
- The string representation of the joined elements.
-
join
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.
-