android.os.MemoryFile#close ( )源码实例Demo

下面列出了android.os.MemoryFile#close ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: fresco   文件: GingerbreadPurgeableDecoder.java
private Bitmap decodeFileDescriptorAsPurgeable(
    CloseableReference<PooledByteBuffer> bytesRef,
    int inputLength,
    byte[] suffix,
    BitmapFactory.Options options) {
  MemoryFile memoryFile = null;
  try {
    memoryFile = copyToMemoryFile(bytesRef, inputLength, suffix);
    FileDescriptor fd = getMemoryFileDescriptor(memoryFile);
    if (mWebpBitmapFactory != null) {
      Bitmap bitmap = mWebpBitmapFactory.decodeFileDescriptor(fd, null, options);
      return Preconditions.checkNotNull(bitmap, "BitmapFactory returned null");
    } else {
      throw new IllegalStateException("WebpBitmapFactory is null");
    }
  } catch (IOException e) {
    throw Throwables.propagate(e);
  } finally {
    if (memoryFile != null) {
      memoryFile.close();
    }
  }
}
 
源代码2 项目: fresco   文件: WebpDecodingTest.java
@Test
public void test_webp_extended_decoding_filedescriptor_bitmap() throws Throwable {
  final MemoryFile memoryFile = getMemoryFile("webp_e.webp");
  final Bitmap bitmap =
      mWebpBitmapFactory.decodeFileDescriptor(getMemoryFileDescriptor(memoryFile), null, null);
  memoryFile.close();
  assertBitmap(bitmap, 480, 320);
}
 
源代码3 项目: fresco   文件: WebpDecodingTest.java
@Test
public void test_webp_extended_with_alpha_decoding_filedescriptor_bitmap() throws Throwable {
  final MemoryFile memoryFile = getMemoryFile("webp_ea.webp");
  final Bitmap bitmap =
      mWebpBitmapFactory.decodeFileDescriptor(getMemoryFileDescriptor(memoryFile), null, null);
  memoryFile.close();
  assertBitmap(bitmap, 400, 301);
}
 
源代码4 项目: fresco   文件: WebpDecodingTest.java
@Test
public void test_webp_lossless_decoding_filedescriptor_bitmap() throws Throwable {
  final MemoryFile memoryFile = getMemoryFile("webp_ll.webp");
  final Bitmap bitmap =
      mWebpBitmapFactory.decodeFileDescriptor(getMemoryFileDescriptor(memoryFile), null, null);
  memoryFile.close();
  assertBitmap(bitmap, 400, 301);
}
 
源代码5 项目: fresco   文件: WebpDecodingTest.java
@Test
public void test_webp_plain_decoding_filedescriptor_bitmap() throws Throwable {
  final MemoryFile memoryFile = getMemoryFile("webp_plain.webp");
  final Bitmap bitmap =
      mWebpBitmapFactory.decodeFileDescriptor(getMemoryFileDescriptor(memoryFile), null, null);
  memoryFile.close();
  assertBitmap(bitmap, 320, 214);
}
 
源代码6 项目: ArgusAPM   文件: IOUtil.java
public static void safeClose(MemoryFile mf) {
    if (mf != null) {
        mf.close();
    }
}
 
 方法所在类
 同类方法