Class StringUtils
- java.lang.Object
-
- nonapi.io.github.classgraph.utils.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 ";".
-
-
-
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 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:
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
- TheIterable
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
- TheIterable
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.
-
-