hu.netmind.ogg
Class DefaultPagingAlgorithm

java.lang.Object
  extended by hu.netmind.ogg.DefaultPagingAlgorithm
All Implemented Interfaces:
PagingAlgorithm

public class DefaultPagingAlgorithm
extends java.lang.Object
implements PagingAlgorithm

This is a default implementation of a paging algorithm. This algorithm simply completes a page around 4-8 kB of data, and sends it the first time it has the chance.


Constructor Summary
DefaultPagingAlgorithm()
           
 
Method Summary
 boolean handleNewPacket(Page page, Packet packet)
          Implementation start a new page every 4-8 kB, if it can, but does not break up a packet to multiple pages, if it fits.
 void handlePageReady(Page page)
          Implementation does not change anything.
 boolean handleWritePage(Page page)
          Return always true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPagingAlgorithm

public DefaultPagingAlgorithm()
Method Detail

handleNewPacket

public boolean handleNewPacket(Page page,
                               Packet packet)
Implementation start a new page every 4-8 kB, if it can, but does not break up a packet to multiple pages, if it fits. This method is not called when constructing the bos.

Specified by:
handleNewPacket in interface PagingAlgorithm
Parameters:
page - The existing page.
packet - The packet arrived.
Returns:
True, if packet should be appended to page, false if current page should close, and a new page should be started to include packet.

handleWritePage

public boolean handleWritePage(Page page)
Return always true.

Specified by:
handleWritePage in interface PagingAlgorithm
Parameters:
page - The page which can be written.
Returns:
True, if the page should be written, false if it should be withheld.

handlePageReady

public void handlePageReady(Page page)
Implementation does not change anything.

Parameters:
page - The page completed.