TextBuffer is used to read the whole text file. Load file using textBuffer.fromFile and fetch the whole file string from the .getText
TextBuffer textBuffer;
textBuffer = new TextBuffer();
textBuffer.fromFile(@"C:\sohail.txt");
print textBuffer.getText();
pause;