本文整理汇总了Java中com.onegravity.rteditor.utils.io.IOUtils.closeQuietly方法的典型用法代码示例。如果您正苦于以下问题:Java IOUtils.closeQuietly方法的具体用法?Java IOUtils.closeQuietly怎么用?Java IOUtils.closeQuietly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.onegravity.rteditor.utils.io.IOUtils
的用法示例。
在下文中一共展示了IOUtils.closeQuietly方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAssetIndex
import com.onegravity.rteditor.utils.io.IOUtils; //导入方法依赖的package包/类
static List<String> getAssetIndex(Context context) {
if (mAssetIndex.isEmpty()) {
InputStream in = null;
BufferedReader reader = null;
try {
in = context.getAssets().open("assets.index");
reader = new BufferedReader(new InputStreamReader(in));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
mAssetIndex.add(line);
}
} catch (final IOException e) {
Log.e(AssetIndex.class.getSimpleName(), e.getMessage(), e);
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(reader);
}
}
return mAssetIndex;
}
示例2: downloadFile
import com.onegravity.rteditor.utils.io.IOUtils; //导入方法依赖的package包/类
private InputStream downloadFile(String sourceFile) {
InputStream in = null;
try {
URL url = new URL(sourceFile);
final HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
in = new BufferedInputStream(urlConnection.getInputStream()) {
@Override
public void close() throws IOException {
super.close();
urlConnection.disconnect();
}
};
} catch (Exception e) {
Log.e(getClass().getSimpleName(), e.getMessage(), e);
IOUtils.closeQuietly(in);
}
return in;
}
示例3: downloadFile
import com.onegravity.rteditor.utils.io.IOUtils; //导入方法依赖的package包/类
private InputStream downloadFile(String sourceFile) {
InputStream in = null;
try {
URL url = new URL(sourceFile);
final HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
in = new BufferedInputStream(urlConnection.getInputStream()) {
public void close() throws IOException {
super.close();
urlConnection.disconnect();
}
};
} catch (Exception e) {
Log.e(getClass().getSimpleName(), e.getMessage(), e);
IOUtils.closeQuietly(in);
}
return in;
}
示例4: getAssetIndex
import com.onegravity.rteditor.utils.io.IOUtils; //导入方法依赖的package包/类
static List<String> getAssetIndex(Context context) {
if (mAssetIndex.isEmpty()) {
InputStream in = null;
BufferedReader reader = null;
try {
in = context.getAssets().open("assets.index");
reader = new BufferedReader(new InputStreamReader(in));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
mAssetIndex.add(line);
}
} catch (final IOException e) {
Log.w(AssetIndex.class.getSimpleName(), "The assets.index file could not be read. If you want to use your own fonts, please copy the fonts to the assets folder and the build code to generate the assets.index file into your build.gradle (for more details consult the readme, chapter fonts)", e);
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(reader);
}
}
return mAssetIndex;
}
示例5: getFontName
import com.onegravity.rteditor.utils.io.IOUtils; //导入方法依赖的package包/类
/**
* Retrieve the file name for a system font.
*
* @param filePath the full path for the font to retrieve.
*
* @return The file name or null of none could be retrieved.
*/
static String getFontName(String filePath) {
TTFRandomAccessFile in = null;
try {
RandomAccessFile file = new RandomAccessFile(filePath, "r");
in = new TTFRandomAccessFile(file);
return getTTFFontName(in, filePath);
} catch (IOException e) {
return null; // Missing permissions or corrupted font file?
}
finally {
IOUtils.closeQuietly(in);
}
}
示例6: closeQuietly
import com.onegravity.rteditor.utils.io.IOUtils; //导入方法依赖的package包/类
public static void closeQuietly(Closeable closeable) {
IOUtils.closeQuietly(closeable);
}