public class Tools extends Object
Modifier and Type | Field and Description |
---|---|
static int |
COPY_BUFFER_SIZE |
static long |
READ_ALL |
Constructor and Description |
---|
Tools() |
Modifier and Type | Method and Description |
---|---|
static void |
assertSimilar(String expected,
String real,
char wildcard)
Compares two string for similarity, allows wildcard.
|
static String |
convertToHtml(String str) |
static int |
copyFile(File source,
File target,
boolean overwrite) |
static File |
createTemporaryDirectory() |
static void |
deleteDirectoryOnExit(File directory) |
static String |
ensureDir(String outputDir) |
static String |
ensureDir(String dir,
String basedir) |
static String |
ensureFileDir(String file,
String basedir) |
static String |
expandProperties(StringToStringMap values,
String content,
boolean leaveMissing) |
static String |
getContentTypeFromFilename(String fileName) |
static String |
getDir(String filePath) |
static String |
getEndpointFromUrl(URL baseUrl) |
static String |
getExtensionForContentType(String contentType) |
static String |
getFileContent(String path) |
static String |
getFilename(String filePath) |
static String |
getTitleProperty(String path) |
static boolean |
isEmpty(String str) |
static boolean |
isPropertyExpansion(String value) |
static boolean |
isSimilar(String expected,
String real,
char wildcard) |
static String |
joinRelativeUrl(String baseUrl,
String url)
Joins a relative url to a base url..
|
static void |
main(String[] args) |
static String |
modifyUrl(String url,
Integer mods) |
static String |
normalizeFileSeparators(String input) |
static void |
openURL(String url) |
static ByteArrayOutputStream |
readAll(InputStream instream,
long maxSize) |
static void |
readAndWrite(InputStream instream,
long maxSize,
OutputStream outstream) |
static String |
removePropertyExpansions(String definitionUrl,
String definition) |
static String |
replaceHost(String endpoint,
String host)
Replaces the host part of the specified endpoint with the specified host
|
static String[] |
tokenizeArgs(String args) |
static long |
writeAll(OutputStream out,
InputStream in) |
public static final int COPY_BUFFER_SIZE
public static final long READ_ALL
public static void openURL(String url)
public static ByteArrayOutputStream readAll(InputStream instream, long maxSize) throws IOException
IOException
public static void readAndWrite(InputStream instream, long maxSize, OutputStream outstream) throws IOException
IOException
public static int copyFile(File source, File target, boolean overwrite) throws IOException
IOException
public static String joinRelativeUrl(String baseUrl, String url)
public static boolean isEmpty(String str)
public static long writeAll(OutputStream out, InputStream in) throws IOException
IOException
public static String expandProperties(StringToStringMap values, String content, boolean leaveMissing)
public static String replaceHost(String endpoint, String host)
endpoint
- the endpoint to modifyhost
- the host to setpublic static void assertSimilar(String expected, String real, char wildcard) throws junit.framework.ComparisonFailure
expected
- real
- wildcard
- junit.framework.ComparisonFailure
public static boolean isSimilar(String expected, String real, char wildcard) throws junit.framework.ComparisonFailure
junit.framework.ComparisonFailure
public static void main(String[] args)
public static File createTemporaryDirectory() throws IOException
IOException
public static void deleteDirectoryOnExit(File directory)
Copyright © 2019. All Rights Reserved.