var ByteBuf: array[0..511] of Byte; //... Stream1.ReadBuffer(ByteBuf[0], 512); for i1:=0 to 511 do x := ByteBuf[i1];