本文整理汇总了Java中org.fdroid.fdroid.Utils.copy方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.copy方法的具体用法?Java Utils.copy怎么用?Java Utils.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fdroid.fdroid.Utils
的用法示例。
在下文中一共展示了Utils.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: send
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
public void send(BluetoothConnection connection) throws IOException {
Utils.debugLog(TAG, "Sending Bluetooth HTTP-ish response...");
Writer output = new OutputStreamWriter(connection.getOutputStream());
output.write("HTTP(ish)/0.1 200 OK\n");
for (Map.Entry<String, String> entry : headers.entrySet()) {
output.write(entry.getKey());
output.write(": ");
output.write(entry.getValue());
output.write("\n");
}
output.write("\n");
output.flush();
if (contentStream != null) {
Utils.copy(contentStream, connection.getOutputStream());
}
output.flush();
}
示例2: writeIndexPage
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
public void writeIndexPage(String repoAddress) {
final String fdroidClientURL = writeFdroidApkToWebroot();
try {
File indexHtml = new File(webRoot, "index.html");
BufferedReader in = new BufferedReader(
new InputStreamReader(assetManager.open("index.template.html"), "UTF-8"));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(indexHtml)));
String line;
while ((line = in.readLine()) != null) {
line = line.replaceAll("\\{\\{REPO_URL\\}\\}", repoAddress);
line = line.replaceAll("\\{\\{CLIENT_URL\\}\\}", fdroidClientURL);
out.write(line);
}
in.close();
out.close();
for (final String file : WEB_ROOT_ASSET_FILES) {
InputStream assetIn = assetManager.open(file);
OutputStream assetOut = new FileOutputStream(new File(webRoot, file));
Utils.copy(assetIn, assetOut);
assetIn.close();
assetOut.close();
}
// make symlinks/copies in each subdir of the repo to make sure that
// the user will always find the bootstrap page.
symlinkEntireWebRootElsewhere("../", fdroidDir);
symlinkEntireWebRootElsewhere("../../", repoDir);
// add in /FDROID/REPO to support bad QR Scanner apps
attemptToMkdir(fdroidDirCaps);
attemptToMkdir(repoDirCaps);
symlinkEntireWebRootElsewhere("../", fdroidDirCaps);
symlinkEntireWebRootElsewhere("../../", repoDirCaps);
} catch (IOException e) {
Log.e(TAG, "Error writing local repo index", e);
}
}