public class

GingerbreadPurgeableDecoder

extends Object
implements PlatformDecoder
java.lang.Object
   ↳ com.facebook.imagepipeline.platform.GingerbreadPurgeableDecoder

Class Overview

Bitmap decoder (Gingerbread to Jelly Bean).

This copies incoming encoded bytes into a MemoryFile, and then decodes them using a file descriptor, thus avoiding using any Java memory at all. This technique only works in JellyBean and below.

Summary

Fields
protected static final byte[] EOI
Public Constructors
GingerbreadPurgeableDecoder()
Public Methods
CloseableReference<Bitmap> decodeFromEncodedImage(EncodedImage encodedImage, Bitmap.Config bitmapConfig)
Creates a bitmap from encoded bytes.
CloseableReference<Bitmap> decodeJPEGFromEncodedImage(EncodedImage encodedImage, Bitmap.Config bitmapConfig, int length)
Creates a bitmap from encoded JPEG bytes.
CloseableReference<Bitmap> pinBitmap(Bitmap bitmap)
Pins the bitmap
Protected Methods
Bitmap decodeByteArrayAsPurgeable(CloseableReference<PooledByteBuffer> bytesRef, BitmapFactory.Options options)
Decodes a byteArray into a purgeable bitmap
Bitmap decodeFileDescriptorAsPurgeable(CloseableReference<PooledByteBuffer> bytesRef, int inputLength, byte[] suffix, BitmapFactory.Options options)
Bitmap decodeJPEGByteArrayAsPurgeable(CloseableReference<PooledByteBuffer> bytesRef, int length, BitmapFactory.Options options)
Decodes a byteArray containing jpeg encoded bytes into a purgeable bitmap

Adds a JFIF End-Of-Image marker if needed before decoding.

static boolean endsWithEOI(CloseableReference<PooledByteBuffer> bytesRef, int length)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.facebook.imagepipeline.platform.PlatformDecoder

Fields

protected static final byte[] EOI

Public Constructors

public GingerbreadPurgeableDecoder ()

Public Methods

public CloseableReference<Bitmap> decodeFromEncodedImage (EncodedImage encodedImage, Bitmap.Config bitmapConfig)

Creates a bitmap from encoded bytes.

Parameters
encodedImage the encoded image with reference to the encoded bytes
bitmapConfig the android.graphics.Bitmap.Config used to create the decoded Bitmap
Returns
  • the bitmap
Throws
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> decodeJPEGFromEncodedImage (EncodedImage encodedImage, Bitmap.Config bitmapConfig, int length)

Creates a bitmap from encoded JPEG bytes. Supports a partial JPEG image.

Parameters
encodedImage the encoded image with reference to the encoded bytes
bitmapConfig the android.graphics.Bitmap.Config used to create the decoded Bitmap
length the number of encoded bytes in the buffer
Returns
  • the bitmap
Throws
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> pinBitmap (Bitmap bitmap)

Pins the bitmap

Protected Methods

protected Bitmap decodeByteArrayAsPurgeable (CloseableReference<PooledByteBuffer> bytesRef, BitmapFactory.Options options)

Decodes a byteArray into a purgeable bitmap

Parameters
bytesRef the byte buffer that contains the encoded bytes
options the options passed to the BitmapFactory

protected Bitmap decodeFileDescriptorAsPurgeable (CloseableReference<PooledByteBuffer> bytesRef, int inputLength, byte[] suffix, BitmapFactory.Options options)

protected Bitmap decodeJPEGByteArrayAsPurgeable (CloseableReference<PooledByteBuffer> bytesRef, int length, BitmapFactory.Options options)

Decodes a byteArray containing jpeg encoded bytes into a purgeable bitmap

Adds a JFIF End-Of-Image marker if needed before decoding.

Parameters
bytesRef the byte buffer that contains the encoded bytes
length the length of bytes for decox
options the options passed to the BitmapFactory

protected static boolean endsWithEOI (CloseableReference<PooledByteBuffer> bytesRef, int length)