Package org.hl7.fhir.utilities
Class Utilities
java.lang.Object
org.hl7.fhir.utilities.Utilities
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enum -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic StringappendDerivedTextToBase(String baseText, String derivedText) Appends a text from a derived element to its base element.static StringappendForwardSlash(String definitions) static Stringstatic StringappendSlash(String definitions) static Stringstatic Stringstatic Stringstatic Stringcapitalize(String s) static intstatic booleancharInRange(char ch, char a, char z) static booleancharInSet(char value, char... array) static Utilities.DecimalStatuscheckDecimal(String value, boolean allowExponent, boolean allowLeadingZero) static StringcleanupTextString(String contents) static booleancompareIgnoreWhitespace(File f1, File f2) static booleancompareIgnoreWhitespace(String fn1, String fn2) static String[]concatStringArray(String[] array1, String[] array2) static booleancontainsInList(String value, String... array) static StringdescribeDuration(long ms) static Stringstatic StringdescribeSize(int length) static StringdescribeSize(long length) static StringDeprecated.static StringencodeUriParam(String param) Deprecated.static StringencodeUriParam(String key, String value) static booleanendsWithInList(String s, String... list) static booleanendsWithInList(String s, Collection<String> list) static booleanstatic booleanequivalent(String l, String r) static booleanequivalentNumber(String l, String r) static Stringstatic StringescapeJava(String doco) static StringescapeJson(String value) static StringescapeJson(String value, boolean escapeUnicodeWhitespace) static Stringstatic Stringstatic StringescapeXmlText(String doco) static booleanexistsInList(int value, int... array) static booleanexistsInList(String value, String... array) static booleanexistsInList(String value, List<String> array) static booleanexistsInListNC(String value, String... array) static booleanexistsInListTrimmed(String value, String... array) static StringextractBaseUrl(String url) static StringextractByRegex(String input, String regex) static StringextractDomain(String source) static StringfhirPathToXPath(String path) Only handles simple FHIRPath expressions of the type produced by the validatorstatic intfindinList(String[] list, String val) static Stringstatic Stringstatic IntegergetDecimalPrecision(String value) static StringgetDirectoryForURL(String url) static Stringstatic StringgetFileNameForName(String name) static StringgetRelativeUrlPath(String root, String path) static StringhighBoundaryForDecimal(String value, int precision) static Stringstatic StringinsertBreakingSpaces(String text, Set<Character> breakingChars) static booleanisAbsoluteFileName(String source) static booleanisAbsoluteUrl(String ref) static booleanstatic booleanstatic booleanisAlphabetic(char c) static booleanisAsciiChar(char ch) static booleanstatic booleanstatic booleanisDigit(char c) static booleanstatic booleanstatic booleanisJavaReservedWord(String word) static booleanstatic booleanstatic booleanstatic booleanstatic booleanisTokenChar(char ch) static booleanstatic booleanstatic booleanisValidCRName(String name) static booleanisValidHtmlAnchorChar(char c) static booleanstatic booleanisWhitespace(int ch) static booleanstatic StringjavaTokenize(String cs, boolean capFirst) static StringlimitString(String text, int length) static StringlistCanonicalUrls(Set<String> keys) static booleanlistValueStartsWith(String s, Set<String> list) static StringlowBoundaryForDecimal(String value, int precision) static Stringstatic ObjectmakeSingleLine(String text) static Stringnmtokenize(String cs) static StringnormaliseEolns(String value) static Stringstatic Stringstatic Stringstatic booleanstatic StringpadInt(int i, int len) static StringpadInt(long i, int len) static Stringstatic StringpadRight(int num, char c, int len) static Stringstatic intstatic Stringstatic StringComposes a path string using by concatenating the passed arguments.static Filestatic Stringstatic Stringstatic StringpluralizeMe(String word) Returns the plural form of the word in the string.static StringreverseSorted(String[] set) reverseSorted(Collection<String> set) static Stringstatic String[]simpleSplit(String cnt, String div) static Stringsingularise(String word) sorted(Collection<String> set) sortedReverse(Collection<String> set) static String[]splitByCamelCase(String name) static List<byte[]>splitBytes(byte[] array, byte[] delimiter) static StringsplitLineForLength(String line, int prefixLength, int indent, int allowedLength) static String[]splitLines(String txt) splitStrings(String src, String regex) static intstartCharCount(String s, char c) static booleanstartsWithInList(String s, String... list) static booleanstartsWithInList(String s, Collection<String> list) static StringstringJoin(String sep, String... array) static booleanstringsEqual(String s1, String s2) static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic StringunCamelCase(String name) static Stringstatic Stringstatic StringuncheckedPath(String... args) Deprecated.static StringunescapeJson(String json) static StringunescapeXml(String xml) static StringupperCamelCase(String value) static Stringstatic Stringstatic String
-
Field Details
-
ONE_MB
- See Also:
-
GB
- See Also:
-
MB
- See Also:
-
KB
- See Also:
-
BT
- See Also:
-
-
Constructor Details
-
Utilities
public Utilities()
-
-
Method Details
-
pluralizeMe
Returns the plural form of the word in the string.Examples:
inflector.pluralize("post") #=> "posts" inflector.pluralize("octopus") #=> "octopi" inflector.pluralize("sheep") #=> "sheep" inflector.pluralize("words") #=> "words" inflector.pluralize("the blue mailman") #=> "the blue mailmen" inflector.pluralize("CamelOctopus") #=> "CamelOctopi"Note that if the
Object.toString()is called on the supplied object, so this method works for non-strings, too.- Parameters:
word- the word that is to be pluralized.- Returns:
- the pluralized form of the word, or the word itself if it could not be pluralized
- See Also:
-
pluralize
-
singularise
-
isInteger
-
isLong
-
isHex
-
isValidId
-
concatStringArray
-
isProhibitedBinaryFile
-
insertBreakingSpaces
-
isDecimal
-
isDecimal
-
checkDecimal
public static Utilities.DecimalStatus checkDecimal(String value, boolean allowExponent, boolean allowLeadingZero) -
camelCase
-
upperCamelCase
-
escapeXml
-
escapeXmlText
-
titleize
-
capitalize
-
asCSV
-
asHtmlBr
-
generateUniqueRandomUUIDPath
- Throws:
IOException
-
cleanupTextString
-
noString
-
appendSlash
-
appendForwardSlash
-
systemEol
-
normaliseEolns
-
unescapeXml
- Throws:
FHIRException
-
unescapeJson
- Throws:
FHIRException
-
isPlural
-
padRight
-
padRight
-
padLeft
-
path
Composes a path string using by concatenating the passed arguments. This method enables all checks for unintended path locations.- Parameters:
args-- Returns:
- Throws:
IOException- See Also:
-
pathFile
- Throws:
IOException
-
path
- Throws:
IOException
-
forcePath
- Throws:
IOException
-
uncheckedPath
Deprecated.Composes a path string using by concatenating the passed arguments. This method does not check for unintentional access to areas of the file system outside of the first entry. ONLY USE THIS METHOD IN CASES WHERE YOU ARE CERTAIN THE COMPOSED PATH IS NOT MALICIOUS.- Parameters:
args-- Returns:
- Throws:
IOException- See Also:
-
pathURL
-
nmtokenize
-
javaTokenize
-
isJavaReservedWord
-
isToken
-
isTokenChar
-
isDigit
-
isAlphabetic
-
appendPeriod
-
removePeriod
-
stripBOM
-
escapeJava
-
splitByCamelCase
-
encodeUri
Deprecated. -
encodeUriParam
-
encodeUriParam
Deprecated. -
normalize
-
normalize
-
normalizeSameCase
-
URLEncode
-
URLDecode
-
charInSet
-
charInRange
-
existsInList
-
containsInList
-
existsInList
-
existsInListTrimmed
-
existsInList
-
existsInListNC
-
stringJoin
-
getFileNameForName
-
isAsciiChar
-
isURL
-
escapeCSV
-
escapeJson
-
escapeJson
-
humanize
-
uncapitalize
-
charCount
-
startCharCount
-
equals
-
compareIgnoreWhitespace
- Throws:
IOException
-
compareIgnoreWhitespace
- Throws:
IOException
-
isAbsoluteUrl
-
isAbsoluteUrlLinkable
-
equivalent
-
equivalentNumber
-
getFileExtension
-
unCamelCaseKeepCapitals
-
unCamelCase
-
isAbsoluteFileName
-
isWindows
-
splitLineForLength
public static String splitLineForLength(String line, int prefixLength, int indent, int allowedLength) -
makeId
-
extractBaseUrl
-
listCanonicalUrls
-
sortedCaseInsensitive
-
sorted
-
sortedReverse
-
sorted
-
reverseSorted
-
reverseSorted
-
analyseStringDiffs
-
fhirPathToXPath
Only handles simple FHIRPath expressions of the type produced by the validator- Parameters:
path-- Returns:
-
describeDuration
-
describeDuration
-
startsWithInList
-
startsWithInList
-
endsWithInList
-
endsWithInList
-
describeSize
-
describeSize
-
splitBytes
-
findinList
-
toString
-
lowBoundaryForDecimal
-
highBoundaryForDecimal
-
getDecimalPrecision
-
padInt
-
padInt
-
makeSingleLine
-
parseInt
-
appendDerivedTextToBase
Appends a text from a derived element to its base element.- Parameters:
baseText- The text set in the base element, ornull.derivedText- The text set in the derived element, starting with "...".- Returns:
- The resulting text.
-
getRelativeUrlPath
-
isValidCRName
-
isAllWhitespace
-
trimWS
-
isWhitespace
-
stringsEqual
-
tail
-
strings
-
stringSet
-
splitStrings
-
stripPara
-
stripAllPara
-
isTxFhirOrgServer
-
splitLines
-
rightTrim
-
urlTail
-
escapeSql
-
simpleSplit
-
stripEoln
-
extractDomain
-
isValidHtmlAnchorChar
-
listValueStartsWith
-
extractByRegex
-
getDirectoryForURL
-
copyAdd
-
limitString
-