public abstract class

PooledByteBufferOutputStream

extends OutputStream
java.lang.Object
   ↳ java.io.OutputStream
     ↳ com.facebook.common.memory.PooledByteBufferOutputStream
Known Direct Subclasses

Class Overview

An OutputStream that produces a PooledByteBuffer.

Expected use for such stream is to first write sequence of bytes to the stream and then call toByteBuffer to produce PooledByteBuffer containing written data. After toByteBuffer returns client can continue writing new data and call toByteBuffer over and over again.

Streams implementing this interface are closeable resources and need to be closed in order to release underlying resources. Close is idempotent operation and after stream was closed, no other method should be called. Streams subclassing PooledByteBufferOutputStream are not allowed to throw IOException from close method.

Summary

Public Constructors
PooledByteBufferOutputStream()
Public Methods
void close()
Closes the stream.
abstract int size()
Returns the total number of bytes written to this stream so far.
abstract PooledByteBuffer toByteBuffer()
Creates a PooledByteBuffer from the contents of the stream.
[Expand]
Inherited Methods
From class java.io.OutputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.io.Flushable
From interface java.lang.AutoCloseable

Public Constructors

public PooledByteBufferOutputStream ()

Public Methods

public void close ()

Closes the stream.

public abstract int size ()

Returns the total number of bytes written to this stream so far.

Returns
  • the number of bytes written to this stream.

public abstract PooledByteBuffer toByteBuffer ()

Creates a PooledByteBuffer from the contents of the stream.