本文整理汇总了Java中org.fdroid.fdroid.Utils.closeQuietly方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.closeQuietly方法的具体用法?Java Utils.closeQuietly怎么用?Java Utils.closeQuietly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fdroid.fdroid.Utils
的用法示例。
在下文中一共展示了Utils.closeQuietly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: downloadFromStream
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
void downloadFromStream(int bufferSize, boolean resumable) throws IOException, InterruptedException {
Utils.debugLog(TAG, "Downloading from stream");
InputStream input = null;
OutputStream outputStream = new FileOutputStream(outputFile, resumable);
try {
input = getInputStream();
// Getting the input stream is slow(ish) for HTTP downloads, so we'll check if
// we were interrupted before proceeding to the download.
throwExceptionIfInterrupted();
copyInputToOutputStream(input, bufferSize, outputStream);
} finally {
Utils.closeQuietly(outputStream);
Utils.closeQuietly(input);
}
// Even if we have completely downloaded the file, we should probably respect
// the wishes of the user who wanted to cancel us.
throwExceptionIfInterrupted();
}
示例2: clearCurrentMDNSService
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
private void clearCurrentMDNSService() {
if (jmdns != null) {
jmdns.unregisterAllServices();
Utils.closeQuietly(jmdns);
pairService = null;
jmdns = null;
}
}
示例3: close
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
public void close() {
for (ClientConnection clientConnection : clients) {
clientConnection.interrupt();
}
interrupt();
if (serverSocket != null) {
Utils.closeQuietly(serverSocket);
}
}
示例4: closeQuietly
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
public void closeQuietly() {
Utils.closeQuietly(input);
Utils.closeQuietly(output);
Utils.closeQuietly(socket);
}
示例5: close
import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
protected void close() {
if (inputStream != null) {
Utils.closeQuietly(inputStream);
}
}