player
Class FrameDataExchange

java.lang.Object
  extended by player.FrameDataExchange

public class FrameDataExchange
extends java.lang.Object

Assume a single producer and a single consumer thread, each of which must to create and contribute just one buffer to make the double-buffering game viable.


Constructor Summary
FrameDataExchange()
           
 
Method Summary
 byte[] getEmptyForFull(byte[] fbuf)
          Producer method -- blocks if necessary until consumer supplies next empty buffer, but does not wait for consumer to take next full buffer.
 byte[] getFullForEmpty(byte[] ebuf)
          Consumer method -- assumes previous empty buffer (if any) has already been taken, but blocks if necessary until producer supplies next full buffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FrameDataExchange

public FrameDataExchange()
Method Detail

getEmptyForFull

public byte[] getEmptyForFull(byte[] fbuf)
                       throws java.lang.InterruptedException
Producer method -- blocks if necessary until consumer supplies next empty buffer, but does not wait for consumer to take next full buffer.

Throws:
java.lang.InterruptedException

getFullForEmpty

public byte[] getFullForEmpty(byte[] ebuf)
                       throws java.lang.InterruptedException
Consumer method -- assumes previous empty buffer (if any) has already been taken, but blocks if necessary until producer supplies next full buffer.

Throws:
java.lang.InterruptedException