本文整理汇总了Java中org.springframework.shell.support.util.FileUtils类的典型用法代码示例。如果您正苦于以下问题:Java FileUtils类的具体用法?Java FileUtils怎么用?Java FileUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileUtils类属于org.springframework.shell.support.util包,在下文中一共展示了FileUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convertCompletionBackIntoUserInputStyle
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
private String convertCompletionBackIntoUserInputStyle(final String originalUserInput,
final String completion) {
if (FileUtils.denotesAbsolutePath(originalUserInput)) {
// Input was originally as a fully-qualified path, so we just keep the
// completion in that form
return completion;
}
if (originalUserInput.startsWith(HOME_DIRECTORY_SYMBOL)) {
// Input originally started with this symbol, so replace the user's home
// directory with it again
Assert.notNull(home, "Home directory could not be determined from system properties");
return HOME_DIRECTORY_SYMBOL + completion.substring(home.length());
}
// The path was working directory specific, so strip the working directory
// given the user never typed it
return completion.substring(getWorkingDirectoryAsString().length());
}
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:DirConverter.java
示例2: convertUserInputIntoAFullyQualifiedPath
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
/**
* If the user input starts with a tilde character (~), replace the tilde character with the
* user's home directory. If the user input does not start with a tilde, simply return the
* original user input without any changes if the input specifies an absolute path, or return an
* absolute path based on the working directory if the input specifies a relative path.
*
* @param userInput the user input, which may commence with a tilde (required)
* @return a string that is guaranteed to no longer contain a tilde as the first character (never
* null)
*/
private String convertUserInputIntoAFullyQualifiedPath(final String userInput) {
if (FileUtils.denotesAbsolutePath(userInput)) {
// Input is already in a fully-qualified path form
return userInput;
}
if (userInput.startsWith(HOME_DIRECTORY_SYMBOL)) {
// Replace this symbol with the user's actual home directory
Assert.notNull(home, "Home directory could not be determined from system properties");
if (userInput.length() > 1) {
return home + userInput.substring(1);
}
}
// The path is working directory specific, so prepend the working directory
String fullPath = getWorkingDirectoryAsString() + userInput;
return fullPath;
}
开发者ID:ampool,项目名称:monarch,代码行数:27,代码来源:DirConverter.java
示例3: convertCompletionBackIntoUserInputStyle
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
private String convertCompletionBackIntoUserInputStyle(
final String originalUserInput, final String completion) {
if (FileUtils.denotesAbsolutePath(originalUserInput)) {
// Input was originally as a fully-qualified path, so we just keep the
// completion in that form
return completion;
}
if (originalUserInput.startsWith(HOME_DIRECTORY_SYMBOL)) {
// Input originally started with this symbol, so replace the user's home
// directory with it again
Assert.notNull(home,
"Home directory could not be determined from system properties");
return HOME_DIRECTORY_SYMBOL + completion.substring(home.length());
}
// The path was working directory specific, so strip the working directory
// given the user never typed it
return completion.substring(getWorkingDirectoryAsString().length());
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:19,代码来源:DirConverter.java
示例4: convertUserInputIntoAFullyQualifiedPath
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
/**
* If the user input starts with a tilde character (~), replace the tilde
* character with the user's home directory. If the user input does not start
* with a tilde, simply return the original user input without any changes if
* the input specifies an absolute path, or return an absolute path based on
* the working directory if the input specifies a relative path.
*
* @param userInput
* the user input, which may commence with a tilde (required)
* @return a string that is guaranteed to no longer contain a tilde as the
* first character (never null)
*/
private String convertUserInputIntoAFullyQualifiedPath(final String userInput) {
if (FileUtils.denotesAbsolutePath(userInput)) {
// Input is already in a fully-qualified path form
return userInput;
}
if (userInput.startsWith(HOME_DIRECTORY_SYMBOL)) {
// Replace this symbol with the user's actual home directory
Assert.notNull(home,
"Home directory could not be determined from system properties");
if (userInput.length() > 1) {
return home + userInput.substring(1);
}
}
// The path is working directory specific, so prepend the working directory
String fullPath = getWorkingDirectoryAsString() + userInput;
return fullPath;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:30,代码来源:DirConverter.java
示例5: getBanner
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
@Override
public String getBanner() {
StringBuilder builder = new StringBuilder();
builder.append(FileUtils.readBanner(SpringDataReleaseCliBannerProvider.class, "banner.txt"));
builder.append(getVersion()).append(OsUtils.LINE_SEPARATOR);
builder.append(OsUtils.LINE_SEPARATOR);
return builder.toString();
}
开发者ID:spring-projects,项目名称:spring-data-dev-tools,代码行数:12,代码来源:SpringDataReleaseCliBannerProvider.java
示例6: getBanner
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
@Override
public String getBanner() {
StringBuilder sb = new StringBuilder();
sb.append(FileUtils.readBanner(Main.class, "/banner.txt"));
sb.append(OsUtils.LINE_SEPARATOR);
sb.append("Connection urls: " + OsUtils.LINE_SEPARATOR);
sb.append(" - Kafka: " + kafkaBrokers);
sb.append(" - Zookeeper: " + zkQuorum);
sb.append(OsUtils.LINE_SEPARATOR);
return sb.toString();
}
开发者ID:Stratio,项目名称:Decision,代码行数:12,代码来源:StratioStreamingBannerProvider.java
示例7: doRun
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
private ExitShellRequest doRun() {
this.stopWatch.start();
try {
String[] commandsToExecuteAndThenQuit = this.commandLine.getShellCommandsToExecute();
ExitShellRequest exitShellRequest;
if (null != commandsToExecuteAndThenQuit) {
boolean successful = false;
exitShellRequest = ExitShellRequest.FATAL_EXIT;
for (String cmd : commandsToExecuteAndThenQuit) {
if (!(successful = this.lineShellComponent.executeCommand(cmd).isSuccess()))
break;
}
if (successful) {
exitShellRequest = ExitShellRequest.NORMAL_EXIT;
}
}
else if (this.applicationArguments.containsOption("help")) {
System.out.println(FileUtils.readBanner(ShellCommandLineRunner.class, "/usage.txt"));
exitShellRequest = ExitShellRequest.NORMAL_EXIT;
} else {
this.lineShellComponent.start();
this.lineShellComponent.promptLoop();
exitShellRequest = this.lineShellComponent.getExitShellRequest();
if (exitShellRequest == null) {
exitShellRequest = ExitShellRequest.NORMAL_EXIT;
}
this.lineShellComponent.waitForComplete();
}
if (this.lineShellComponent.isDevelopmentMode()) {
System.out.println("Total execution time: " + this.stopWatch
.getLastTaskTimeMillis() + " ms");
}
return exitShellRequest;
} catch (Exception ex) {
throw new ShellException(ex.getMessage(), ex);
} finally {
HandlerUtils.flushAllHandlers(this.logger);
this.stopWatch.stop();
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:47,代码来源:ShellCommandLineRunner.java
示例8: getBanner
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
@Override
public String getBanner() {
return FileUtils.readBanner(DataFlowBannerProvider.class, "/dataflow-banner.txt") +
"\n" + getVersion() + "\n";
}
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:6,代码来源:DataFlowBannerProvider.java
示例9: doRun
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
private ExitShellRequest doRun() {
this.stopWatch.start();
try {
String[] commandsToExecuteAndThenQuit = this.commandLine.getShellCommandsToExecute();
ExitShellRequest exitShellRequest;
if (null != commandsToExecuteAndThenQuit) {
boolean successful = false;
exitShellRequest = ExitShellRequest.FATAL_EXIT;
for (String cmd : commandsToExecuteAndThenQuit) {
if (!(successful = this.lineShellComponent.executeCommand(cmd).isSuccess()))
break;
}
if (successful) {
exitShellRequest = ExitShellRequest.NORMAL_EXIT;
}
}
else if (this.applicationArguments.containsOption("help")) {
System.out.println(FileUtils.readBanner(ShellCommandLineRunner.class, "/usage.txt"));
exitShellRequest = ExitShellRequest.NORMAL_EXIT;
}
else {
this.lineShellComponent.start();
this.lineShellComponent.promptLoop();
exitShellRequest = this.lineShellComponent.getExitShellRequest();
if (exitShellRequest == null) {
exitShellRequest = ExitShellRequest.NORMAL_EXIT;
}
this.lineShellComponent.waitForComplete();
}
if (this.lineShellComponent.isDevelopmentMode()) {
System.out.println("Total execution time: " + this.stopWatch.getLastTaskTimeMillis() + " ms");
}
return exitShellRequest;
}
catch (Exception ex) {
throw new ShellException(ex.getMessage(), ex);
}
finally {
HandlerUtils.flushAllHandlers(this.logger);
this.stopWatch.stop();
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:49,代码来源:ShellCommandLineRunner.java
示例10: getBanner
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
@Override
public String getBanner() {
return FileUtils.readBanner(DataFlowBannerProvider.class, "/dataflow-banner.txt") + "\n" + getVersion() + "\n";
}
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:5,代码来源:DataFlowBannerProvider.java
示例11: getBanner
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
@Override
public String getBanner() {
return FileUtils.readBanner(AmbariShell.class, "banner.txt");
}
开发者ID:hortonworks,项目名称:ambari-shell,代码行数:5,代码来源:AmbariBanner.java
示例12: simple
import org.springframework.shell.support.util.FileUtils; //导入依赖的package包/类
/**
* Prints an elephant to the console.
*
* @return elephant
*/
@CliCommand(value = "hello", help = "Prints a simple elephant to the console")
public String simple() {
return FileUtils.readBanner(AmbariShell.class, "elephant.txt");
}
开发者ID:hortonworks,项目名称:ambari-shell,代码行数:10,代码来源:ElephantCommand.java
注:本文中的org.springframework.shell.support.util.FileUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论