public class

MemoryPooledByteBufferFactory

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

Class Overview

A factory to provide instances of MemoryPooledByteBuffer and MemoryPooledByteBufferOutputStream

Summary

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

Public Constructors

public MemoryPooledByteBufferFactory (MemoryChunkPool pool, PooledByteStreams pooledByteStreams)

Public Methods

public MemoryPooledByteBuffer newByteBuffer (InputStream inputStream)

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

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

public MemoryPooledByteBuffer newByteBuffer (byte[] bytes)

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

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

public MemoryPooledByteBuffer newByteBuffer (InputStream inputStream, int initialCapacity)

Creates a new PooledByteBuffer 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 bytebuf
Returns
  • an instance of PooledByteBuffer
Throws
IOException

public MemoryPooledByteBuffer newByteBuffer (int size)

Creates a new PooledByteBuffer instance of given size.

Parameters
size in bytes
Returns
  • an instance of PooledByteBuffer

public MemoryPooledByteBufferOutputStream newOutputStream ()

Creates a new PooledByteBufferOutputStream instance with default initial capacity

Returns
  • a new PooledByteBufferOutputStream

public MemoryPooledByteBufferOutputStream newOutputStream (int initialCapacity)

Creates a new PooledByteBufferOutputStream instance with the specified initial capacity

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