home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Java / JavaRadioStation / Source / com / apple / jens / radio / BufferStream.java < prev    next >
Encoding:
Java Source  |  2000-09-28  |  1.0 KB  |  52 lines  |  [TEXT/CWIE]

  1.  
  2. package jens.radio;
  3.  
  4. import java.io.*;
  5.  
  6.  
  7. /** A BufferStream is a special collection of Buffers.
  8.  
  9.     Buffers are added to the end by calling addBuffer, and
  10.     Buffers are read sequentially by BufferStreamIterators. <p>
  11.     
  12.     The addBuffer method will block if it's too far ahead of the
  13.     nearest reader -- this prevents the number of buffers from exploding,
  14.     since Buffers are typically much faster to create then to send. <p>
  15.     
  16.     New Iterators start out from the <i>latest</i> available Buffer, since
  17.     a new listener should start out as close to real-time as possible.
  18.     This means that Buffers that have already been read by the farthest-behind
  19.     Iterator are no longer reachable through the BufferStream, and are
  20.     released. */
  21.     
  22. public class BufferStream {
  23.  
  24.     public BufferStream( ) {
  25.         fBuffers = new Vector();
  26.     }
  27.     
  28.     
  29.     public void addBuffer( Buffer buf ) {
  30.         
  31.     }
  32.     
  33.     
  34.     public BufferIterator iterate( ) {
  35.     }
  36.     
  37. }
  38.  
  39.  
  40. public class BufferStreamIterator {
  41.  
  42.     BufferStreamIterator( BufferStream s ) {
  43.         fBufferStream = s;
  44.     }
  45.     
  46.     
  47.     public Buffer next( ) {
  48.         •
  49.     }
  50.     
  51. }
  52.