當前位置: 首頁>>代碼示例>>Java>>正文


Java FileCopyUtils.copyToString方法代碼示例

本文整理匯總了Java中org.springframework.util.FileCopyUtils.copyToString方法的典型用法代碼示例。如果您正苦於以下問題:Java FileCopyUtils.copyToString方法的具體用法?Java FileCopyUtils.copyToString怎麽用?Java FileCopyUtils.copyToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.util.FileCopyUtils的用法示例。


在下文中一共展示了FileCopyUtils.copyToString方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.springframework.util.FileCopyUtils; //導入方法依賴的package包/類
@Override
public void run(ApplicationArguments args) throws Exception {
	if (ShellUtils.hasHelpOption(args)) {
		String usageInstructions;

		final Reader reader = new InputStreamReader(getInputStream(HelpAwareShellApplicationRunner.class, "/usage.txt"));

		try {
			usageInstructions = FileCopyUtils.copyToString(new BufferedReader(reader));
			usageInstructions.replaceAll("(\\r|\\n)+", System.getProperty("line.separator"));
		}
		catch (Exception ex) {
			throw new IllegalStateException("Cannot read stream", ex);
		}
		System.out.println(usageInstructions);
	}
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-skipper,代碼行數:18,代碼來源:HelpAwareShellApplicationRunner.java

示例2: getScriptAsString

import org.springframework.util.FileCopyUtils; //導入方法依賴的package包/類
@Override
public String getScriptAsString() throws IOException {
	synchronized (this.lastModifiedMonitor) {
		this.lastModified = retrieveLastModifiedTime();
	}
	Reader reader = this.resource.getReader();
	return FileCopyUtils.copyToString(reader);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:ResourceScriptSource.java

示例3: read

import org.springframework.util.FileCopyUtils; //導入方法依賴的package包/類
public <T> T read(Class<T> type) throws IOException {
	BufferedReader in = new BufferedReader(
			new InputStreamReader(this.systemStreams.in()));
	long startTime = System.currentTimeMillis();
	while (!in.ready()) {
		Assert.state(System.currentTimeMillis() - startTime < this.timeout,
				"Timeout waiting for input");
	}
	String content = FileCopyUtils.copyToString(in);
	String resolved = this.environment.resolvePlaceholders(content);
	return this.objectMapper.readValue(new StringReader(resolved), type);
}
 
開發者ID:spring-io,項目名稱:artifactory-resource,代碼行數:13,代碼來源:SystemInput.java

示例4: jsonContent

import org.springframework.util.FileCopyUtils; //導入方法依賴的package包/類
private RequestMatcher jsonContent(Resource expected) {
	return (request) -> {
		String actualJson = ((MockClientHttpRequest) request).getBodyAsString();
		String expectedJson = FileCopyUtils.copyToString(new InputStreamReader(
				expected.getInputStream(), Charset.forName("UTF-8")));
		assertJson(actualJson, expectedJson);
	};
}
 
開發者ID:spring-io,項目名稱:artifactory-resource,代碼行數:9,代碼來源:HttpArtifactoryBuildRunsTests.java

示例5: readToString

import org.springframework.util.FileCopyUtils; //導入方法依賴的package包/類
public static String readToString(DataBuffer dataBuffer) {
    try {
        return FileCopyUtils.copyToString(new InputStreamReader(dataBuffer.asInputStream()));
    }
    catch (IOException e) {
        return e.getMessage();
    }
}
 
開發者ID:jbrixhe,項目名稱:spring-webflux-client,代碼行數:9,代碼來源:DataBuffers.java

示例6: binaryOf

import org.springframework.util.FileCopyUtils; //導入方法依賴的package包/類
private String binaryOf(String name) throws IOException {
    String resName = "/contracts/" + name + ".bin";
    InputStream stream = getClass().getResourceAsStream(resName);
    if (stream == null) throw new FileNotFoundException(resName);
    return FileCopyUtils.copyToString(new InputStreamReader(stream));
}
 
開發者ID:papyrusglobal,項目名稱:state-channels,代碼行數:7,代碼來源:Deployer.java

示例7: readInternal

import org.springframework.util.FileCopyUtils; //導入方法依賴的package包/類
@Override
protected String readInternal(Class<? extends String> clazz, HttpInputMessage inputMessage) throws IOException {
	Charset charset = getContentTypeCharset(inputMessage.getHeaders().getContentType());
	return FileCopyUtils.copyToString(new InputStreamReader(inputMessage.getBody(), charset));
}
 
開發者ID:yi-jun,項目名稱:aaden-pay,代碼行數:6,代碼來源:SpringHttpMessageConverter.java


注:本文中的org.springframework.util.FileCopyUtils.copyToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。