public int read(byte[] content) throws IOException {
		synchronized (chunks)
		{
			
			if (currentChunk == null)
				return 0;
			
			if (isAtEnd())
				return 0;
			
			int toRead = content.length;
			int posArray = 0;
			while (true)
			{
				if (positionWithinChunk + toRead <= currentChunk.filled)
				{
					System.arraycopy(currentChunk.chunk, positionWithinChunk, content, posArray, toRead);
					positionWithinChunk += toRead;
					return content.length;
				} else {
					int currentStep = currentChunk.filled - positionWithinChunk;
					try 
					{
						System.arraycopy(currentChunk.chunk, positionWithinChunk, content, posArray, currentStep);
					} catch (Exception ex)
					{
						ex.printStackTrace();
					}
					posArray += currentStep;
					toRead -= currentStep;
					positionWithinChunk += currentStep;
					boolean isAtEnd = isAtEnd();
					
					if (isAtEnd)
						return content.length - toRead;
					
					currentChunk = getNextChunk(currentChunk);
					positionWithinChunk = 0;
				}
			}
		}
	}