use of org.gradle.internal.resource.ExternalResourceWriteResult in project gradle by gradle.
the class LocalFileStandInExternalResource method put.
@Override
public ExternalResourceWriteResult put(ReadableContent location) {
try {
if (!localFile.canWrite()) {
localFile.delete();
}
Files.createParentDirs(localFile);
InputStream input = location.open();
try {
CountingOutputStream output = new CountingOutputStream(new FileOutputStream(localFile));
try {
IOUtils.copyLarge(input, output);
} finally {
output.close();
}
return new ExternalResourceWriteResult(output.getCount());
} finally {
input.close();
}
} catch (IOException e) {
throw ResourceExceptions.putFailed(getURI(), e);
}
}
use of org.gradle.internal.resource.ExternalResourceWriteResult in project MyLuaApp-Build-Core by dingyi222666.
the class LocalFileStandInExternalResource method put.
@Override
public ExternalResourceWriteResult put(ReadableContent location) {
try {
if (!localFile.canWrite()) {
localFile.delete();
}
Files.createParentDirs(localFile);
InputStream input = location.open();
try {
CountingOutputStream output = new CountingOutputStream(new FileOutputStream(localFile));
try {
IOUtils.copyLarge(input, output);
} finally {
output.close();
}
return new ExternalResourceWriteResult(output.getCount());
} finally {
input.close();
}
} catch (IOException e) {
throw ResourceExceptions.putFailed(getURI(), e);
}
}
Aggregations