public final class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
convertToDebianVersion(String version,
boolean apply,
String envName,
Date timestamp)
Convert the project version to a version suitable for a Debian package.
|
static int |
copy(InputStream pInput,
OutputStream pOutput) |
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 |
isNullOrEmpty(String str)
Returns true if string is null or empty.
|
static String |
joinPaths(String... elements)
Join together path elements with File.separator.
|
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 static int copy(InputStream pInput, OutputStream pOutput) throws IOException
IOExceptionpublic static String toHex(byte[] bytes)
public static String replaceVariables(VariableResolver pResolver, String pExpression, String pOpen, String pClose)
pResolver - pExpression - public static byte[] toUnixLineEndings(InputStream input) throws IOException
input - IOExceptionpublic static String convertToDebianVersion(String version, boolean apply, String envName, Date timestamp)
version - the project version to convert to a Debian package versiontimestamp - the date used as the timestamp to replace the SNAPSHOT suffixpublic 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 String joinPaths(String... elements)
elements - The path elements to joinpublic static boolean isNullOrEmpty(String str)
Copyright © 2014. All rights reserved.