Package org.antlr.v4.runtime.misc
Class Utils
java.lang.Object
org.antlr.v4.runtime.misc.Utils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intcharArraySize(IntegerList data) static booleanstatic StringescapeWhitespace(String s, boolean escapeSpaces) static Stringstatic <T> Stringstatic <T> Stringstatic intnumNonnull(Object[] data) static char[]static char[]static <T> voidstatic <T> voidstatic <T> voidremoveAllElements(Collection<T> data, T value) static char[]toCharArray(IntegerList data) Convert the list to a UTF-16 encoded char array.Convert array of strings to string→index map.static IntervalSetstatic voidstatic voidstatic void
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
join
-
join
-
join
-
equals
-
numNonnull
-
removeAllElements
-
escapeWhitespace
-
writeFile
- Throws:
IOException
-
writeFile
- Throws:
IOException
-
writeFile
public static void writeFile(@NotNull String fileName, @NotNull String content, @Nullable String encoding) throws IOException - Throws:
IOException
-
readFile
- Throws:
IOException
-
readFile
@NotNull public static char[] readFile(@NotNull String fileName, @Nullable String encoding) throws IOException - Throws:
IOException
-
removeAll
-
removeAll
-
toMap
Convert array of strings to string→index map. Useful for converting rulenames to name→ruleindex map. -
toCharArray
Convert the list to a UTF-16 encoded char array. If all values are less than the 0xFFFF 16-bit code point limit then this is just a char array of 16-bit char as usual. For values in the supplementary range, encode them as two UTF-16 code units. -
charArraySize
-
toSet
- Since:
- 4.5
-