public class CommandUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SPRING_PROPERTIES
Default Spring Properties Location.
|
Modifier and Type | Method and Description |
---|---|
static String |
ask(String prompt,
Object... args)
Ask a question to the console user.
|
static void |
clearConsole()
Clear the console.
|
static void |
copyResourceToStream(Class<?> resourceRoot,
String resource,
OutputStream os)
Copy the resource to the specified stream.
|
static void |
copyResourceToWriter(Class<?> resourceRoot,
String resource,
Writer writer)
Copy the resource to the specified writer.
|
static void |
copyResourceToWriter(Class<?> resourceRoot,
String resource,
Writer writer,
Map<String,String> replacement)
Copy the resource to the specified writer.
|
static List<File> |
getBrowserExecutable()
Get a web browser executable file.
|
static List<File> |
getFiles(FileFilter fileFilter)
Get a list of files that match the filter.
|
static InetAddress |
getInterface()
Get the interface.
|
static int |
getPort()
Get the port.
|
static PropertyResolver |
getSpringProperties()
Get spring properties.
|
static void |
setupConsoleLogger()
Setup a console logger.
|
static void |
setupSystemProperties(String defaultContext,
String propMatch)
Setup system properties.
|
static void |
shutdownConsoleLogger()
Shutdown console logger.
|
static Process |
startBrowser(InetAddress ia,
int port,
File startWebBrowser)
Start a web browser.
|
public static final String DEFAULT_SPRING_PROPERTIES
public static String ask(String prompt, Object... args) throws IOException
prompt
- the prompt.args
- the arguments for the prompt (printf style).IOException
- if an IO error occurs.public static void clearConsole()
public static void copyResourceToStream(Class<?> resourceRoot, String resource, OutputStream os) throws IOException
resourceRoot
- resource root.resource
- the resource.os
- the output stream.IOException
- if an error occurs.public static void copyResourceToWriter(Class<?> resourceRoot, String resource, Writer writer) throws IOException
resourceRoot
- resource root.resource
- the resource.writer
- the writer.IOException
- if an error occurs.public static void copyResourceToWriter(Class<?> resourceRoot, String resource, Writer writer, @Nullable Map<String,String> replacement) throws IOException
resourceRoot
- resource root.resource
- the resource.writer
- the writer.replacement
- optional replacement mapping.IOException
- if an error occurs.public static List<File> getBrowserExecutable()
public static List<File> getFiles(FileFilter fileFilter)
fileFilter
- the filter.public static InetAddress getInterface() throws Exception
Exception
- if an error occurs.public static int getPort() throws IOException
IOException
- if an error occurs.public static PropertyResolver getSpringProperties()
public static void setupConsoleLogger()
public static void setupSystemProperties(String defaultContext, String propMatch) throws IOException
defaultContext
- the default context.propMatch
- property to match as default.IOException
- if an error occurspublic static void shutdownConsoleLogger()
@Nullable public static Process startBrowser(InetAddress ia, int port, File startWebBrowser) throws Exception
ia
- address.port
- port.startWebBrowser
- attempt to start the specified web browser.Exception
- if an error occurs.