// Path: src/uk/ac/open/audio/streaming/StreamPlayer.java
// public enum State
// {
// 	/** Downloading but not yet ready to play */
// 	WAITBEFOREPLAY,
// 	/** Downloaded enough that you should be able to start playing */
// 	READYTOPLAY,
// 	/** Completely downloaded */
// 	FULLYLOADED,
// 	/** Fully loaded, but audio buffer is empty */
// 	BUFFEREMPTY,
// 	/** Closed (no more playback possible) */
//   CLOSED
// }


import java.awt.*;
import java.io.*;
import java.util.*;
import uk.ac.open.audio.*;
import static uk.ac.open.audio.streaming.StreamPlayer.State.*;
					{
					}
				}

				// OK we have some data.
				int totalRead=0;
				while(blockPos<data.size())
				{
					DataBlock current=data.get(blockPos);

					// How much data is available in current block?
					int available=current.getData().length-innerPos;

					// We have more (or the same) available than needed
					if(available>=len)
					{
						System.arraycopy(current.getData(),innerPos,b,off,len);
						innerPos+=len;
						totalRead+=len;
						if(innerPos==current.getData().length)
						{
							innerPos=0;
							blockPos++;
						}
						totalPos+=totalRead;
						return totalRead;
					}

					// We have less available than needed
					System.arraycopy(current.getData(),innerPos,b,off,available);
// Path: src/uk/ac/open/audio/streaming/StreamPlayer.java
// public enum State
// {
// 	/** Downloading but not yet ready to play */
// 	WAITBEFOREPLAY,
// 	/** Downloaded enough that you should be able to start playing */
// 	READYTOPLAY,
// 	/** Completely downloaded */
// 	FULLYLOADED,
// 	/** Fully loaded, but audio buffer is empty */
// 	BUFFEREMPTY,
// 	/** Closed (no more playback possible) */
//   CLOSED
// }


// Path: src/uk/ac/open/audio/streaming/StreamPlayer.java
import java.awt.*;
import java.io.*;
import java.util.*;
import uk.ac.open.audio.*;
import static uk.ac.open.audio.streaming.StreamPlayer.State.*;

					{
					}
				}

				// OK we have some data.
				int totalRead=0;
				while(blockPos<data.size())
				{
					DataBlock current=data.get(blockPos);

					// How much data is available in current block?
					int available=current.getData().length-innerPos;

					// We have more (or the same) available than needed
					if(available>=len)
					{
						System.arraycopy(current.getData(),innerPos,b,off,len);
						innerPos+=len;
						totalRead+=len;
						if(innerPos==current.getData().length)
						{
							innerPos=0;
							blockPos++;
						}
						totalPos+=totalRead;
						return totalRead;
					}

					// We have less available than needed
					System.arraycopy(current.getData(),innerPos,b,off,available);
					totalRead+=available;