java.lang.Object
org.openpdf.util.GeneralUtil
- Author:
- Patrick Wright
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic voidDumps an exception to the console, only the last 5 lines of the stack trace.static StringescapeHTML(@Nullable String s) Converts any special characters into their corresponding HTML entities , for example invalid input: '<' to <.static @Nullable URLgetURLFromClasspath(Object obj, String resource) static StringBuilderhtmlEscapeSpace(String uri) static booleanisMacOSX()static @Nullable InputStreamopenStreamFromClasspath(Object obj, String resource) static intParses an integer from a string using less restrictive rules about which characters we won't accept.
-
Constructor Details
-
GeneralUtil
public GeneralUtil()
-
-
Method Details
-
ciEquals
-
openStreamFromClasspath
@CheckReturnValue public static @Nullable InputStream openStreamFromClasspath(Object obj, String resource) -
getURLFromClasspath
-
dumpShortException
Dumps an exception to the console, only the last 5 lines of the stack trace. -
isMacOSX
@CheckReturnValue public static boolean isMacOSX() -
htmlEscapeSpace
-
parseIntRelaxed
Parses an integer from a string using less restrictive rules about which characters we won't accept. This scavenges the supplied string for any numeric character, while dropping all others.- Parameters:
s- The string to parse- Returns:
- The number represented by the passed string, or 0 if the string is null, empty, white-space only, contains only non-numeric characters, or simply evaluates to 0 after parsing (e.g. "0")
-
escapeHTML
Converts any special characters into their corresponding HTML entities , for example invalid input: '<' to <. This is done using a character by character test, so you may consider other approaches for large documents. Make sure you declare the entities that might appear in this replacement, e.g. the latin-1 entities This method was taken from a code-samples website, written and hosted by Real Gagnon, at ....- Parameters:
s- The String which may contain characters to escape.- Returns:
- The string with the characters as HTML entities.
-