Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static String |
convertToDebianVersion(String version,
boolean apply,
String envName,
String template,
Date timestamp)
Convert the project version to a version suitable for a Debian package.
|
static int |
copy(InputStream pInput,
OutputStream pOutput) |
static String |
defaultString(String str,
String fallback)
Return fallback if first string is null or empty
|
static Collection<String> |
getKnownPGPSecureRingLocations()
Get the known locations where the secure keyring can be located.
|
static File |
guessKeyRingFile()
Tries to guess location of the user secure keyring using various
heuristics.
|
static boolean |
isBlank(CharSequence cs)
Check if a CharSequence is whitespace, empty ("") or null.
|
static boolean |
isNullOrEmpty(String str)
Returns true if string is null or empty.
|
static String |
joinLocalPath(String... paths) |
static String |
joinUnixPath(String... paths) |
static String |
lookupIfEmpty(String value,
Map<String,String> props,
String key)
Extracts value from map if given value is null.
|
static String |
movePath(String file,
String target)
Construct new path by replacing file directory part.
|
static String |
replaceVariables(VariableResolver pResolver,
String pExpression,
String pOpen,
String pClose)
Substitute the variables in the given expression with the
values from the resolver
|
static String |
stripLeadingSlash(String s) |
static String |
stripPath(int p,
String s) |
static String |
toHex(byte[] bytes) |
static byte[] |
toUnixLineEndings(InputStream input)
Replaces new line delimiters in the input stream with the Unix line feed.
|
public Utils()
public static int copy(InputStream pInput, OutputStream pOutput) throws IOException
IOException
public static String joinUnixPath(String... paths)
public static String joinLocalPath(String... paths)
public static String stripLeadingSlash(String s)
public static String replaceVariables(VariableResolver pResolver, String pExpression, String pOpen, String pClose)
pResolver
- pExpression
- public static byte[] toUnixLineEndings(InputStream input) throws IOException
input
- IOException
public static String convertToDebianVersion(String version, boolean apply, String envName, String template, Date timestamp)
version
- the project version to convert to a Debian package versiontemplate
- the template used to replace -SNAPSHOT, the timestamp format is in brackets,
the rest of the string is preserved (prefix[yyMMdd]suffix -> prefix151230suffix)timestamp
- the UTC date used as the timestamp to replace the SNAPSHOT suffix.public static String movePath(String file, String target)
file
- path to movetarget
- new path directorypublic static String lookupIfEmpty(String value, Map<String,String> props, String key)
value
- current valueprops
- properties to extract value fromkey
- property name to extractpublic static Collection<String> getKnownPGPSecureRingLocations()
public static File guessKeyRingFile() throws FileNotFoundException
FileNotFoundException
- if no keyring file foundpublic static boolean isNullOrEmpty(String str)
public static String defaultString(String str, String fallback)
public static boolean isBlank(CharSequence cs)
StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false
cs
- the CharSequence to check, may be nulltrue
if the CharSequence is null, empty or whitespaceCopyright © 2018. All rights reserved.