Java Code Examples for android.os.MemoryFile#close()
The following examples show how to use
android.os.MemoryFile#close() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GingerbreadPurgeableDecoder.java From fresco with MIT License | 6 votes |
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(); } } }
Example 2
Source File: WebpDecodingTest.java From fresco with MIT License | 5 votes |
@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); }
Example 3
Source File: WebpDecodingTest.java From fresco with MIT License | 5 votes |
@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); }
Example 4
Source File: WebpDecodingTest.java From fresco with MIT License | 5 votes |
@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); }
Example 5
Source File: WebpDecodingTest.java From fresco with MIT License | 5 votes |
@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); }
Example 6
Source File: IOUtil.java From ArgusAPM with Apache License 2.0 | 4 votes |
public static void safeClose(MemoryFile mf) { if (mf != null) { mf.close(); } }