## org.red5.server.stream
Class PlayBuffer

    java.lang.Object
      org.red5.server.stream.PlayBuffer

    public class PlayBuffer

extends Object

A Play buffer for sending VOD. The implementation is not synchronized.

Author:
  The Red5 Project (red5@osflash.org), Steven Gong (steven.gong@gmail.com)

Constructor Summary
`PlayBuffer(long capacity)` Create play buffer with given capacity

Method Summary
`void` `clear()` Empty this buffer.
`long` `getCapacity()` Buffer capacity in bytes.
`int` `getMessageCount()` Number of messages in buffer.
`long` `getMessageSize()` Total message size in bytes.
`RTMPMessage` `peekMessage()` Peek a message but not take it from the buffer.
`boolean` `putMessage(RTMPMessage message)` Put a message into this buffer.
`void` `setCapacity(long capacity)` Setter for capacity
`RTMPMessage` `takeMessage()` Take a message from this buffer.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PlayBuffer

    public PlayBuffer(long capacity)

  Create play buffer with given capacity

  Parameters:
    `capacity` - Capacity of buffer

Method Detail

### getCapacity

    public long getCapacity()

  Buffer capacity in bytes.

  Returns:
    Buffer capacity in bytes

### setCapacity

    public void setCapacity(long capacity)

  Setter for capacity

  Parameters:
    `capacity` - New capacity

### getMessageCount

    public int getMessageCount()

  Number of messages in buffer.

  Returns:
    Number of messages in buffer

### getMessageSize

    public long getMessageSize()

  Total message size in bytes.

  Returns:
    Total message size in bytes

### putMessage

    public boolean putMessage(RTMPMessage message)

  Put a message into this buffer.

  Parameters:
    `message` - RTMP message
  Returns:
    `true` indicates success and `false` indicates buffer is full.

### takeMessage

    public RTMPMessage takeMessage()

  Take a message from this buffer. The message count decreases.

  Returns:
    `null` if buffer is empty.

### peekMessage

    public RTMPMessage peekMessage()

  Peek a message but not take it from the buffer. The message count doesn't change.

  Returns:
    `null` if buffer is empty.

### clear

    public void clear()

  Empty this buffer.

Copyright © 2006-2010 The Red5 Project