public interface

PooledByteBufferFactory

com.facebook.common.memory.PooledByteBufferFactory
Known Indirect Subclasses

Class Overview

A factory to create instances of PooledByteBuffer and PooledByteBufferOutputStream

Summary

Public Methods
abstract PooledByteBuffer newByteBuffer(InputStream inputStream)
Creates a new bytebuf instance by reading in the entire contents of the input stream
abstract PooledByteBuffer newByteBuffer(byte[] bytes)
Creates a new bytebuf instance by reading in the entire contents of the byte array
abstract PooledByteBuffer newByteBuffer(InputStream inputStream, int initialCapacity)
Creates a new PooledByteBuffer instance with an initial capacity, and reading the entire contents of the input stream
abstract PooledByteBuffer newByteBuffer(int size)
Creates a new PooledByteBuffer instance of given size.
abstract PooledByteBufferOutputStream newOutputStream()
Creates a new PooledByteBufferOutputStream instance with default initial capacity
abstract PooledByteBufferOutputStream newOutputStream(int initialCapacity)
Creates a new PooledByteBufferOutputStream instance with the specified initial capacity

Public Methods

public abstract PooledByteBuffer 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 abstract PooledByteBuffer 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 abstract PooledByteBuffer 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 abstract PooledByteBuffer newByteBuffer (int size)

Creates a new PooledByteBuffer instance of given size.

Parameters
size in bytes
Returns
  • an instance of PooledByteBuffer

public abstract PooledByteBufferOutputStream newOutputStream ()

Creates a new PooledByteBufferOutputStream instance with default initial capacity

Returns
  • a new PooledByteBufferOutputStream

public abstract PooledByteBufferOutputStream 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