本文整理汇总了Java中org.gradle.internal.IoActions类的典型用法代码示例。如果您正苦于以下问题:Java IoActions类的具体用法?Java IoActions怎么用?Java IoActions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IoActions类属于org.gradle.internal包,在下文中一共展示了IoActions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMetaData
import org.gradle.internal.IoActions; //导入依赖的package包/类
public ExternalResourceMetaData getMetaData(URI location, boolean revalidate) {
LOGGER.debug("Attempting to get resource metadata: {}", location);
S3Object s3Object = s3Client.getMetaData(location);
if (s3Object == null) {
return null;
}
try {
ObjectMetadata objectMetadata = s3Object.getObjectMetadata();
return new DefaultExternalResourceMetaData(location,
objectMetadata.getLastModified().getTime(),
objectMetadata.getContentLength(),
objectMetadata.getContentType(),
objectMetadata.getETag(),
null); // Passing null for sha1 - TODO - consider using the etag which is an MD5 hash of the file (when less than 5Gb)
} finally {
IoActions.closeQuietly(s3Object);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:S3ResourceConnector.java
示例2: writeTo
import org.gradle.internal.IoActions; //导入依赖的package包/类
@Override
public org.gradle.api.java.archives.Manifest writeTo(Object path) {
File manifestFile = fileResolver.resolve(path);
try {
File parentFile = manifestFile.getParentFile();
if (parentFile != null) {
FileUtils.forceMkdir(parentFile);
}
IoActions.withResource(new FileOutputStream(manifestFile), new Action<FileOutputStream>() {
@Override
public void execute(FileOutputStream fileOutputStream) {
writeTo(fileOutputStream);
}
});
return this;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:DefaultManifest.java
示例3: serialize
import org.gradle.internal.IoActions; //导入依赖的package包/类
public SerializedPayload serialize(Object payload) {
final SerializeMap map = classLoaderRegistry.newSerializeSession();
try {
StreamByteBuffer buffer = new StreamByteBuffer();
final ObjectOutputStream objectStream = new PayloadSerializerObjectOutputStream(buffer.getOutputStream(), map);
try {
objectStream.writeObject(payload);
} finally {
IoActions.closeQuietly(objectStream);
}
Map<Short, ClassLoaderDetails> classLoaders = new HashMap<Short, ClassLoaderDetails>();
map.collectClassLoaderDefinitions(classLoaders);
return new SerializedPayload(classLoaders, buffer.readAsListOfByteArrays());
} catch (IOException e) {
throw UncheckedException.throwAsUncheckedException(e);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:PayloadSerializer.java
示例4: readPrefixes
import org.gradle.internal.IoActions; //导入依赖的package包/类
private static Trie readPrefixes(RuntimeShadedJarType type) {
final Trie.Builder builder = new Trie.Builder();
IoActions.withResource(ImplementationDependencyRelocator.class.getResourceAsStream(type.getIdentifier() + "-relocated.txt"), new ErroringAction<InputStream>() {
@Override
protected void doExecute(InputStream thing) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(thing, Charset.forName("UTF-8")));
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.length() > 0) {
builder.addWord(line);
}
}
}
});
return builder.build();
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:ImplementationDependencyRelocator.java
示例5: generate
import org.gradle.internal.IoActions; //导入依赖的package包/类
@TaskAction
public void generate() {
IoActions.writeTextFile(getOutputFile(), new ErroringAction<BufferedWriter>() {
@Override
public void doExecute(final BufferedWriter bufferedWriter) throws Exception {
Trie packages = collectPackages();
packages.dump(false, new ErroringAction<String>() {
@Override
public void doExecute(String s) throws Exception {
bufferedWriter.write(s);
bufferedWriter.newLine();
}
});
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:PackageListGenerator.java
示例6: getMetaData
import org.gradle.internal.IoActions; //导入依赖的package包/类
public ExternalResourceMetaData getMetaData(URI uri, boolean revalidate) {
String location = uri.toString();
LOGGER.debug("Constructing external resource metadata: {}", location);
CloseableHttpResponse response = http.performHead(location, revalidate);
ExternalResourceMetaData result = null;
if (response != null) {
HttpResponseResource resource = new HttpResponseResource("HEAD", uri, response);
try {
result = resource.getMetaData();
} finally {
IoActions.closeQuietly(resource);
}
}
return result;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:HttpResourceAccessor.java
示例7: write
import org.gradle.internal.IoActions; //导入依赖的package包/类
void write(File outputFile) throws IOException {
IoActions.writeTextFile(outputFile, new ErroringAction<BufferedWriter>() {
@Override
protected void doExecute(BufferedWriter writer) throws Exception {
final Map<String, JavadocOptionFileOption<?>> options = new TreeMap<String, JavadocOptionFileOption<?>>(optionFile.getOptions());
JavadocOptionFileWriterContext writerContext = new JavadocOptionFileWriterContext(writer);
JavadocOptionFileOption<?> localeOption = options.remove("locale");
if (localeOption != null) {
localeOption.write(writerContext);
}
for (final String option : options.keySet()) {
options.get(option).write(writerContext);
}
optionFile.getSourceNames().write(writerContext);
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:JavadocOptionFileWriter.java
示例8: pack
import org.gradle.internal.IoActions; //导入依赖的package包/类
@Override
public void pack(final TaskOutputsInternal taskOutputs, OutputStream output, final TaskOutputOriginWriter writeOrigin) {
IoActions.withResource(new TarOutputStream(output, "utf-8"), new Action<TarOutputStream>() {
@Override
public void execute(TarOutputStream outputStream) {
outputStream.setLongFileMode(TarOutputStream.LONGFILE_POSIX);
outputStream.setBigNumberMode(TarOutputStream.BIGNUMBER_POSIX);
outputStream.setAddPaxHeadersForNonAsciiNames(true);
try {
packMetadata(writeOrigin, outputStream);
pack(taskOutputs, outputStream);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:TarTaskOutputPacker.java
示例9: write
import org.gradle.internal.IoActions; //导入依赖的package包/类
void write(File outputFile) throws IOException {
IoActions.writeTextFile(outputFile, new ErroringAction<BufferedWriter>() {
@Override
protected void doExecute(BufferedWriter writer) throws Exception {
final Map<String, JavadocOptionFileOption> options = new TreeMap<String, JavadocOptionFileOption>(optionFile.getOptions());
JavadocOptionFileWriterContext writerContext = new JavadocOptionFileWriterContext(writer);
JavadocOptionFileOption localeOption = options.remove("locale");
if (localeOption != null) {
localeOption.write(writerContext);
}
for (final String option : options.keySet()) {
options.get(option).write(writerContext);
}
optionFile.getSourceNames().write(writerContext);
}
});
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:21,代码来源:JavadocOptionFileWriter.java
示例10: execute
import org.gradle.internal.IoActions; //导入依赖的package包/类
public WorkResult execute(final CopyActionProcessingStream stream) {
ZipOutputStream zipOutStr;
try {
zipOutStr = new ZipOutputStream(new FileOutputStream(zipFile));
} catch (Exception e) {
throw new GradleException(String.format("Could not create ZIP '%s'.", zipFile), e);
}
IoActions.withResource(zipOutStr, new Action<ZipOutputStream>() {
public void execute(ZipOutputStream outputStream) {
stream.process(new StreamAction(outputStream));
}
});
return new SimpleWorkResult(true);
}
开发者ID:EvidentSolutions,项目名称:gradle-gzjar-plugin,代码行数:18,代码来源:GzJarCopyAction.java
示例11: build
import org.gradle.internal.IoActions; //导入依赖的package包/类
public void build(File initScriptFile, final List<File> classpath) {
IoActions.writeTextFile(initScriptFile, new ErroringAction<Writer>() {
@Override
protected void doExecute(Writer writer) throws Exception {
writer.write("allprojects {\n");
writer.write(" buildscript {\n");
writer.write(" dependencies {\n");
writer.write(" classpath files(\n");
int i = 0;
for (File file : classpath) {
writer.write(
String.format(" '%s'", TextUtil.escapeString(file.getAbsolutePath())));
if (++i != classpath.size()) {
writer.write(",\n");
}
}
writer.write("\n");
writer.write(" )\n");
writer.write(" }\n");
writer.write(" }\n");
writer.write("}\n");
}
});
}
开发者ID:JakeWharton,项目名称:paraphrase,代码行数:25,代码来源:ClasspathAddingInitScriptBuilder.java
示例12: build
import org.gradle.internal.IoActions; //导入依赖的package包/类
public void build(File initScriptFile, final List<File> classpath) {
IoActions.writeTextFile(initScriptFile, new ErroringAction<Writer>() {
@Override
protected void doExecute(Writer writer) throws Exception {
writer.write("allprojects {\n");
writer.write(" buildscript {\n");
writer.write(" dependencies {\n");
writer.write(" classpath files(\n");
int i = 0;
for (File file : classpath) {
writer.write(String.format(" '%s'", TextUtil.escapeString(file.getAbsolutePath())));
if (++i != classpath.size()) {
writer.write(",\n");
}
}
writer.write("\n");
writer.write(" )\n");
writer.write(" }\n");
writer.write(" }\n");
writer.write("}\n");
}
});
}
开发者ID:werval,项目名称:werval,代码行数:24,代码来源:ClasspathAddingInitScriptBuilder.java
示例13: writeProbe
import org.gradle.internal.IoActions; //导入依赖的package包/类
private static void writeProbe(File workingDir) {
File probeFile = new File(workingDir, JavaProbe.CLASSNAME + ".class");
try {
IoActions.withResource(new FileOutputStream(probeFile), new ErroringAction<FileOutputStream>() {
@Override
protected void doExecute(FileOutputStream thing) throws Exception {
thing.write(JavaProbe.dump());
}
});
} catch (FileNotFoundException e) {
throw new GradleException("Unable to write Java probe file", e);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:JavaInstallationProbe.java
示例14: writeTo
import org.gradle.internal.IoActions; //导入依赖的package包/类
public DefaultMavenPom writeTo(Object path) {
IoActions.writeTextFile(fileResolver.resolve(path), POM_FILE_ENCODING, new Action<BufferedWriter>() {
public void execute(BufferedWriter writer) {
writeTo(writer);
}
});
return this;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultMavenPom.java
示例15: createFatJar
import org.gradle.internal.IoActions; //导入依赖的package包/类
private void createFatJar(final File outputJar, final Iterable<? extends File> files, final ProgressLogger progressLogger) {
final File tmpFile = tempFileFor(outputJar);
IoActions.withResource(openJarOutputStream(tmpFile), new ErroringAction<ZipOutputStream>() {
@Override
protected void doExecute(ZipOutputStream jarOutputStream) throws Exception {
processFiles(jarOutputStream, files, new byte[BUFFER_SIZE], new HashSet<String>(), new LinkedHashMap<String, List<String>>(), progressLogger);
jarOutputStream.finish();
}
});
GFileUtils.moveFile(tmpFile, outputJar);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:RuntimeShadedJarCreator.java
示例16: processJarFile
import org.gradle.internal.IoActions; //导入依赖的package包/类
private void processJarFile(final ZipOutputStream outputStream, File file, final byte[] buffer, final Set<String> seenPaths, final Map<String, List<String>> services) throws IOException {
IoActions.withResource(openJarFile(file), new ErroringAction<ZipInputStream>() {
@Override
protected void doExecute(ZipInputStream inputStream) throws Exception {
ZipEntry zipEntry = inputStream.getNextEntry();
while (zipEntry != null) {
processEntry(outputStream, inputStream, zipEntry, buffer, seenPaths, services);
zipEntry = inputStream.getNextEntry();
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:RuntimeShadedJarCreator.java
示例17: processJarFile
import org.gradle.internal.IoActions; //导入依赖的package包/类
private void processJarFile(File file, final Trie.Builder builder) throws IOException {
IoActions.withResource(openJarFile(file), new ErroringAction<ZipInputStream>() {
@Override
protected void doExecute(ZipInputStream inputStream) throws Exception {
ZipEntry zipEntry = inputStream.getNextEntry();
while (zipEntry != null) {
processEntry(zipEntry, builder);
zipEntry = inputStream.getNextEntry();
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:PackageListGenerator.java
示例18: writeReport
import org.gradle.internal.IoActions; //导入依赖的package包/类
private void writeReport(final BuildComparisonResult result, final File reportDir, FileStore<String> fileStore, final Map<String, String> hostAttributes) {
if (reportDir.exists() && reportDir.list().length > 0) {
GFileUtils.cleanDirectory(reportDir);
}
fileStore.moveFilestore(new File(reportDir, FILES_DIR_NAME));
final Charset encoding = Charset.defaultCharset();
IoActions.writeTextFile(new File(reportDir, HTML_REPORT_FILE_NAME), encoding.name(), new Action<BufferedWriter>() {
public void execute(BufferedWriter writer) {
createResultRenderer(encoding, reportDir, hostAttributes).render(result, writer);
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:GradleBuildComparison.java
示例19: sanitize
import org.gradle.internal.IoActions; //导入依赖的package包/类
public void sanitize(final File in, File out) {
IoActions.writeTextFile(out, new ErroringAction<BufferedWriter>() {
@Override
protected void doExecute(BufferedWriter writer) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(in)));
String line;
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine()) != null) {
if (sanitizeFunction.skipLine(line)) {
continue;
}
List<String> data = LINE_SPLITTER.splitToList(line);
if (data.size() == 2) {
String stackTraces = data.get(0);
String suffix = data.get(1);
List<String> stackTraceElements = STACKTRACE_SPLITTER.splitToList(stackTraces);
List<String> remapped = new ArrayList<String>(stackTraceElements.size());
for (String stackTraceElement : stackTraceElements) {
String mapped = sanitizeFunction.map(stackTraceElement);
if (mapped != null) {
remapped.add(mapped);
}
}
if (!remapped.isEmpty()) {
sb.setLength(0);
STACKTRACE_JOINER.appendTo(sb, remapped);
sb.append(' ');
sb.append(suffix);
sb.append("\n");
writer.write(sb.toString());
}
}
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:37,代码来源:FlameGraphSanitizer.java
示例20: getSuites
import org.gradle.internal.IoActions; //导入依赖的package包/类
public List<File> getSuites(File testSuitesDir) {
List<File> suites = new ArrayList<File>();
suites.addAll(suiteXmlFiles);
if (suiteXmlBuilder != null) {
File buildSuiteXml = new File(testSuitesDir.getAbsolutePath(), "build-suite.xml");
if (buildSuiteXml.exists()) {
if (!buildSuiteXml.delete()) {
throw new RuntimeException("failed to remove already existing build-suite.xml file");
}
}
IoActions.writeTextFile(buildSuiteXml, new ErroringAction<BufferedWriter>() {
@Override
protected void doExecute(BufferedWriter writer) throws Exception {
writer.write("<!DOCTYPE suite SYSTEM \"http://testng.org/testng-1.0.dtd\">");
writer.newLine();
writer.write(suiteXmlWriter.toString());
}
});
suites.add(buildSuiteXml);
}
return suites;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:31,代码来源:TestNGOptions.java
注:本文中的org.gradle.internal.IoActions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论