public class

NativePooledByteBufferFactory

extends Object
implements PooledByteBufferFactory
java.lang.Object
   ↳ com.facebook.imagepipeline.memory.NativePooledByteBufferFactory

Class Overview

A factory to provide instances of NativePooledByteBuffer and NativePooledByteBufferOutputStream

Summary

Public Constructors
NativePooledByteBufferFactory(NativeMemoryChunkPool pool, PooledByteStreams pooledByteStreams)
Public Methods
NativePooledByteBuffer newByteBuffer(InputStream inputStream)
Creates a new NativePooledByteBuffer instance by reading in the entire contents of the input stream
NativePooledByteBuffer newByteBuffer(byte[] bytes)
Creates a new NativePooledByteBuffer instance by reading in the entire contents of the byte array
NativePooledByteBuffer newByteBuffer(InputStream inputStream, int initialCapacity)
Creates a new NativePooledByteBuffer instance with an initial capacity, and reading the entire contents of the input stream
NativePooledByteBuffer newByteBuffer(int size)
Creates a new PooledByteBuffer instance of given size.
NativePooledByteBufferOutputStream newOutputStream()
Creates a new NativePooledByteBufferOutputStream instance with default initial capacity
NativePooledByteBufferOutputStream newOutputStream(int initialCapacity)
Creates a new NativePooledByteBufferOutputStream instance with the specified initial capacity
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.facebook.common.memory.PooledByteBufferFactory

Public Constructors

public NativePooledByteBufferFactory (NativeMemoryChunkPool pool, PooledByteStreams pooledByteStreams)

Public Methods

public NativePooledByteBuffer newByteBuffer (InputStream inputStream)

Creates a new NativePooledByteBuffer instance by reading in the entire contents of the input stream

Parameters
inputStream the input stream to read from
Returns
  • an instance of the NativePooledByteBuffer
Throws
IOException

public NativePooledByteBuffer newByteBuffer (byte[] bytes)

Creates a new NativePooledByteBuffer instance by reading in the entire contents of the byte array

Parameters
bytes the byte array to read from
Returns
  • an instance of the NativePooledByteBuffer

public NativePooledByteBuffer newByteBuffer (InputStream inputStream, int initialCapacity)

Creates a new NativePooledByteBuffer instance with an initial capacity, and reading the entire contents of the input stream

Parameters
inputStream the input stream to read from
initialCapacity initial allocation size for the PooledByteBuffer
Returns
  • an instance of NativePooledByteBuffer
Throws
IOException

public NativePooledByteBuffer newByteBuffer (int size)

Creates a new PooledByteBuffer instance of given size.

Parameters
size in bytes
Returns
  • an instance of PooledByteBuffer

public NativePooledByteBufferOutputStream newOutputStream ()

Creates a new NativePooledByteBufferOutputStream instance with default initial capacity

Returns
  • a new NativePooledByteBufferOutputStream

public NativePooledByteBufferOutputStream newOutputStream (int initialCapacity)

Creates a new NativePooledByteBufferOutputStream instance with the specified initial capacity

Parameters
initialCapacity initial allocation size for the underlying output stream
Returns
  • a new NativePooledByteBufferOutputStream