Stream of consciousness is a term used in literary criticism for a literary technique that reports the thought processes of a person.
If it is done in context with the surrounding world it is called interior or internal monologue. That means it is unspoken, and in some cases could not be spoken. For example, in Mikhail Bulgakov's Heart of a Dog (1925) the first chapter is entirely based on the dog's unspoken thoughts on the world about him.