public class

PooledByteBufferInputStream

extends InputStream
java.lang.Object
   ↳ java.io.InputStream
     ↳ com.facebook.common.memory.PooledByteBufferInputStream

Class Overview

An InputStream implementation over a PooledByteBuffer instance

Summary

Public Constructors
PooledByteBufferInputStream(PooledByteBuffer pooledByteBuffer)
Creates a new inputstream instance over the specific buffer.
Public Methods
int available()
Returns the number of bytes still available to read
void mark(int readlimit)
Sets a mark position in this inputstream.
boolean markSupported()
Returns true since this class supports mark(int) and reset() methods
int read()
int read(byte[] buffer, int offset, int length)
Reads at most length bytes from this stream and stores them in byte array buffer starting at offset.
int read(byte[] buffer)
void reset()
Resets this stream to the last marked location.
long skip(long byteCount)
Skips byteCount (or however many bytes are available) bytes in the stream
[Expand]
Inherited Methods
From class java.io.InputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Public Constructors

public PooledByteBufferInputStream (PooledByteBuffer pooledByteBuffer)

Creates a new inputstream instance over the specific buffer.

Parameters
pooledByteBuffer the buffer to read from

Public Methods

public int available ()

Returns the number of bytes still available to read

public void mark (int readlimit)

Sets a mark position in this inputstream. The parameter readlimit is ignored. Sending reset() will reposition the stream back to the marked position.

Parameters
readlimit ignored.

public boolean markSupported ()

Returns true since this class supports mark(int) and reset() methods

public int read ()

public int read (byte[] buffer, int offset, int length)

Reads at most length bytes from this stream and stores them in byte array buffer starting at offset.

Parameters
buffer the buffer to read data into
offset start offset in the buffer
length max number of bytes to read
Returns
  • number of bytes read

public int read (byte[] buffer)

public void reset ()

Resets this stream to the last marked location. This implementation resets the position to either the marked position, the start position supplied in the constructor or 0 if neither has been provided.

public long skip (long byteCount)

Skips byteCount (or however many bytes are available) bytes in the stream

Parameters
byteCount number of bytes to skip
Returns
  • number of bytes actually skipped