public override FrameHeader Parse(System.IO.Stream stream)
{
byte[] header=new byte[6];
if(stream.Read(header, 0, 6)!=6)
{
//TODO Create a new exception class for frame parsing errors.
throw new FrameParsingException("Could not read frame's header.");
}
if(header[0]==0)//reached the padding
{
return null;
}
int frameSize=(int)header[3]*(1<<16)+(int)header[4]*(1<<8)+(int)header[5];
string frameID=Encoding.GetEncoding("ISO-8859-1").GetString(header, 0, 3);
return new FrameHeader(frameID, frameSize);
}